3 test_description
='apply same filename'
7 test_expect_success setup
'
8 for i in a b c d e f g h i j k l m
12 cp same_fn other_fn &&
13 git add same_fn other_fn &&
16 test_expect_success
'apply same filename with independent changes' '
17 sed -i -e "s/^d/z/" same_fn &&
20 sed -i -e "s/^i/y/" same_fn &&
22 cp same_fn same_fn2 &&
28 test_expect_success
'apply same filename with overlapping changes' '
30 sed -i -e "s/^d/z/" same_fn &&
33 sed -i -e "s/^e/y/" same_fn &&
35 cp same_fn same_fn2 &&
41 test_expect_success
'apply same new filename after rename' '
44 sed -i -e "s/^d/z/" new_fn &&
46 git diff -M --cached > patch1 &&
47 sed -i -e "s/^e/y/" new_fn &&
51 git apply --index patch1 &&
55 test_expect_success
'apply same old filename after rename -- should fail.' '
58 sed -i -e "s/^d/z/" new_fn &&
60 git diff -M --cached > patch1 &&
62 sed -i -e "s/^e/y/" same_fn &&
65 test_must_fail git apply patch1
68 test_expect_success
'apply A->B (rename), C->A (rename), A->A -- should pass.' '
71 sed -i -e "s/^d/z/" new_fn &&
73 git diff -M --cached > patch1 &&
74 git commit -m "a rename" &&
75 git mv other_fn same_fn
76 sed -i -e "s/^e/y/" same_fn &&
78 git diff -M --cached >> patch1 &&
79 sed -i -e "s/^g/x/" same_fn &&
81 git reset --hard HEAD^ &&