3 test_description='Merge-recursive merging renames'
6 test_expect_success setup \
9 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
10 b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
11 c cccccccccccccccccccccccccccccccccccccccccccccccc
12 d dddddddddddddddddddddddddddddddddddddddddddddddd
13 e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
14 f ffffffffffffffffffffffffffffffffffffffffffffffff
15 g gggggggggggggggggggggggggggggggggggggggggggggggg
16 h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
17 i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
18 j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
19 k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
20 l llllllllllllllllllllllllllllllllllllllllllllllll
21 m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
22 n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
23 o oooooooooooooooooooooooooooooooooooooooooooooooo
27 A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
28 B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
29 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
30 D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
31 E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
32 F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
33 G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
34 H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
35 I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
36 J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
37 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
38 L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
39 M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
40 N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
41 O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
45 git commit -m initial &&
50 sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
52 git commit -a -m "master updates A" &&
55 sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
56 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
58 git update-index --add --remove A B M N &&
59 git commit -m "white renames A->B, M->N" &&
62 sed -e "/^g /s/.*/g : red changes a line/" <A >B &&
63 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
65 git update-index --add --remove A B M N &&
66 git commit -m "red renames A->B, M->N" &&
69 sed -e "/^g /s/.*/g : blue changes a line/" <A >C &&
70 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
72 git update-index --add --remove A C M N &&
73 git commit -m "blue renames A->C, M->N" &&
77 test_expect_success 'pull renaming branch into unrenaming one' \
81 echo "BAD: should have conflicted"
85 test "$(git ls-files -u B | wc -l)" -eq 3 || {
86 echo "BAD: should have left stages for B"
89 test "$(git ls-files -s N | wc -l)" -eq 1 || {
90 echo "BAD: should have merged N"
96 }" B | grep master || {
97 echo "BAD: should have listed our change first"
100 test "$(git diff white N | wc -l)" -eq 0 || {
101 echo "BAD: should have taken colored branch"
106 test_expect_success 'pull renaming branch into another renaming one' \
111 git pull . white && {
112 echo "BAD: should have conflicted"
115 test "$(git ls-files -u B | wc -l)" -eq 3 || {
116 echo "BAD: should have left stages"
119 test "$(git ls-files -s N | wc -l)" -eq 1 || {
120 echo "BAD: should have merged N"
127 echo "BAD: should have listed our change first"
130 test "$(git diff white N | wc -l)" -eq 0 || {
131 echo "BAD: should have taken colored branch"
136 test_expect_success 'pull unrenaming branch into renaming one' \
140 git pull . master && {
141 echo "BAD: should have conflicted"
144 test "$(git ls-files -u B | wc -l)" -eq 3 || {
145 echo "BAD: should have left stages"
148 test "$(git ls-files -s N | wc -l)" -eq 1 || {
149 echo "BAD: should have merged N"
156 echo "BAD: should have listed our change first"
159 test "$(git diff white N | wc -l)" -eq 0 || {
160 echo "BAD: should have taken colored branch"
165 test_expect_success 'pull conflicting renames' \
170 echo "BAD: should have conflicted"
173 test "$(git ls-files -u A | wc -l)" -eq 1 || {
174 echo "BAD: should have left a stage"
177 test "$(git ls-files -u B | wc -l)" -eq 1 || {
178 echo "BAD: should have left a stage"
181 test "$(git ls-files -u C | wc -l)" -eq 1 || {
182 echo "BAD: should have left a stage"
185 test "$(git ls-files -s N | wc -l)" -eq 1 || {
186 echo "BAD: should have merged N"
193 echo "BAD: should have listed our change first"
196 test "$(git diff white N | wc -l)" -eq 0 || {
197 echo "BAD: should have taken colored branch"