]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6022-merge-rename.sh
merge-recursive: Avoid doubly merging rename/add conflict contents
[thirdparty/git.git] / t / t6022-merge-rename.sh
CommitLineData
b825e6ff
JH
1#!/bin/sh
2
3test_description='Merge-recursive merging renames'
4. ./test-lib.sh
5
af6e1751
EN
6modify () {
7 sed -e "$1" <"$2" >"$2.x" &&
8 mv "$2.x" "$2"
9}
10
b825e6ff
JH
11test_expect_success setup \
12'
13cat >A <<\EOF &&
14a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
15b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
16c cccccccccccccccccccccccccccccccccccccccccccccccc
17d dddddddddddddddddddddddddddddddddddddddddddddddd
18e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
19f ffffffffffffffffffffffffffffffffffffffffffffffff
20g gggggggggggggggggggggggggggggggggggggggggggggggg
21h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
22i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
23j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
24k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
25l llllllllllllllllllllllllllllllllllllllllllllllll
26m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
27n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
28o oooooooooooooooooooooooooooooooooooooooooooooooo
29EOF
30
31cat >M <<\EOF &&
32A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
33B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
34C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
35D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
36E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
37F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
38G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
39H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
40I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
41J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
42K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
43L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
44M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
45N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
46O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
47EOF
48
49git add A M &&
5b329a5f 50git commit -m "initial has A and M" &&
b825e6ff
JH
51git branch white &&
52git branch red &&
53git branch blue &&
5b329a5f 54git branch yellow &&
8a359819
AR
55git branch change &&
56git branch change+rename &&
b825e6ff
JH
57
58sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
59mv A+ A &&
60git commit -a -m "master updates A" &&
61
5b329a5f
JH
62git checkout yellow &&
63rm -f M &&
64git commit -a -m "yellow removes M" &&
65
b825e6ff
JH
66git checkout white &&
67sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
68sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
69rm -f A M &&
70git update-index --add --remove A B M N &&
71git commit -m "white renames A->B, M->N" &&
72
73git checkout red &&
74sed -e "/^g /s/.*/g : red changes a line/" <A >B &&
75sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
76rm -f A M &&
77git update-index --add --remove A B M N &&
78git commit -m "red renames A->B, M->N" &&
79
80git checkout blue &&
81sed -e "/^g /s/.*/g : blue changes a line/" <A >C &&
82sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
83rm -f A M &&
84git update-index --add --remove A C M N &&
85git commit -m "blue renames A->C, M->N" &&
86
8a359819
AR
87git checkout change &&
88sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
89mv A+ A &&
90git commit -q -a -m "changed" &&
91
92git checkout change+rename &&
93sed -e "/^g /s/.*/g : changed line/" <A >B &&
94rm A &&
95git update-index --add B &&
96git commit -q -a -m "changed and renamed" &&
97
b825e6ff
JH
98git checkout master'
99
100test_expect_success 'pull renaming branch into unrenaming one' \
101'
102 git show-branch
103 git pull . white && {
104 echo "BAD: should have conflicted"
5b329a5f 105 return 1
b825e6ff
JH
106 }
107 git ls-files -s
108 test "$(git ls-files -u B | wc -l)" -eq 3 || {
109 echo "BAD: should have left stages for B"
5b329a5f 110 return 1
b825e6ff
JH
111 }
112 test "$(git ls-files -s N | wc -l)" -eq 1 || {
113 echo "BAD: should have merged N"
5b329a5f 114 return 1
b825e6ff
JH
115 }
116 sed -ne "/^g/{
117 p
118 q
119 }" B | grep master || {
120 echo "BAD: should have listed our change first"
5b329a5f 121 return 1
b825e6ff
JH
122 }
123 test "$(git diff white N | wc -l)" -eq 0 || {
124 echo "BAD: should have taken colored branch"
5b329a5f 125 return 1
b825e6ff
JH
126 }
127'
128
129test_expect_success 'pull renaming branch into another renaming one' \
130'
fcc387db 131 rm -f B
b825e6ff
JH
132 git reset --hard
133 git checkout red
134 git pull . white && {
135 echo "BAD: should have conflicted"
5b329a5f 136 return 1
b825e6ff
JH
137 }
138 test "$(git ls-files -u B | wc -l)" -eq 3 || {
139 echo "BAD: should have left stages"
5b329a5f 140 return 1
b825e6ff
JH
141 }
142 test "$(git ls-files -s N | wc -l)" -eq 1 || {
143 echo "BAD: should have merged N"
5b329a5f 144 return 1
b825e6ff
JH
145 }
146 sed -ne "/^g/{
147 p
148 q
149 }" B | grep red || {
150 echo "BAD: should have listed our change first"
5b329a5f 151 return 1
b825e6ff
JH
152 }
153 test "$(git diff white N | wc -l)" -eq 0 || {
154 echo "BAD: should have taken colored branch"
5b329a5f 155 return 1
b825e6ff
JH
156 }
157'
158
159test_expect_success 'pull unrenaming branch into renaming one' \
160'
161 git reset --hard
162 git show-branch
163 git pull . master && {
164 echo "BAD: should have conflicted"
5b329a5f 165 return 1
b825e6ff
JH
166 }
167 test "$(git ls-files -u B | wc -l)" -eq 3 || {
168 echo "BAD: should have left stages"
5b329a5f 169 return 1
b825e6ff
JH
170 }
171 test "$(git ls-files -s N | wc -l)" -eq 1 || {
172 echo "BAD: should have merged N"
5b329a5f 173 return 1
b825e6ff
JH
174 }
175 sed -ne "/^g/{
176 p
177 q
178 }" B | grep red || {
179 echo "BAD: should have listed our change first"
5b329a5f 180 return 1
b825e6ff
JH
181 }
182 test "$(git diff white N | wc -l)" -eq 0 || {
183 echo "BAD: should have taken colored branch"
5b329a5f 184 return 1
b825e6ff
JH
185 }
186'
187
724b511d
JH
188test_expect_success 'pull conflicting renames' \
189'
190 git reset --hard
191 git show-branch
192 git pull . blue && {
193 echo "BAD: should have conflicted"
5b329a5f 194 return 1
724b511d
JH
195 }
196 test "$(git ls-files -u A | wc -l)" -eq 1 || {
197 echo "BAD: should have left a stage"
5b329a5f 198 return 1
724b511d
JH
199 }
200 test "$(git ls-files -u B | wc -l)" -eq 1 || {
201 echo "BAD: should have left a stage"
5b329a5f 202 return 1
724b511d
JH
203 }
204 test "$(git ls-files -u C | wc -l)" -eq 1 || {
205 echo "BAD: should have left a stage"
5b329a5f 206 return 1
724b511d
JH
207 }
208 test "$(git ls-files -s N | wc -l)" -eq 1 || {
209 echo "BAD: should have merged N"
5b329a5f 210 return 1
724b511d
JH
211 }
212 sed -ne "/^g/{
213 p
214 q
215 }" B | grep red || {
216 echo "BAD: should have listed our change first"
5b329a5f 217 return 1
724b511d
JH
218 }
219 test "$(git diff white N | wc -l)" -eq 0 || {
220 echo "BAD: should have taken colored branch"
5b329a5f
JH
221 return 1
222 }
223'
224
225test_expect_success 'interference with untracked working tree file' '
226
227 git reset --hard
228 git show-branch
229 echo >A this file should not matter
230 git pull . white && {
231 echo "BAD: should have conflicted"
232 return 1
233 }
234 test -f A || {
235 echo "BAD: should have left A intact"
236 return 1
237 }
238'
239
240test_expect_success 'interference with untracked working tree file' '
241
242 git reset --hard
243 git checkout white
244 git show-branch
245 rm -f A
246 echo >A this file should not matter
247 git pull . red && {
248 echo "BAD: should have conflicted"
249 return 1
250 }
251 test -f A || {
252 echo "BAD: should have left A intact"
253 return 1
254 }
255'
256
257test_expect_success 'interference with untracked working tree file' '
258
259 git reset --hard
260 rm -f A M
261 git checkout -f master
262 git tag -f anchor
263 git show-branch
264 git pull . yellow || {
265 echo "BAD: should have cleanly merged"
266 return 1
267 }
268 test -f M && {
269 echo "BAD: should have removed M"
270 return 1
271 }
272 git reset --hard anchor
273'
274
275test_expect_success 'updated working tree file should prevent the merge' '
276
277 git reset --hard
278 rm -f A M
279 git checkout -f master
280 git tag -f anchor
281 git show-branch
282 echo >>M one line addition
283 cat M >M.saved
284 git pull . yellow && {
285 echo "BAD: should have complained"
286 return 1
287 }
4fdf71be 288 test_cmp M M.saved || {
5b329a5f
JH
289 echo "BAD: should have left M intact"
290 return 1
291 }
292 rm -f M.saved
293'
294
295test_expect_success 'updated working tree file should prevent the merge' '
296
297 git reset --hard
298 rm -f A M
299 git checkout -f master
300 git tag -f anchor
301 git show-branch
302 echo >>M one line addition
303 cat M >M.saved
304 git update-index M
305 git pull . yellow && {
306 echo "BAD: should have complained"
307 return 1
308 }
4fdf71be 309 test_cmp M M.saved || {
5b329a5f
JH
310 echo "BAD: should have left M intact"
311 return 1
312 }
313 rm -f M.saved
314'
315
316test_expect_success 'interference with untracked working tree file' '
317
318 git reset --hard
319 rm -f A M
320 git checkout -f yellow
321 git tag -f anchor
322 git show-branch
323 echo >M this file should not matter
324 git pull . master || {
325 echo "BAD: should have cleanly merged"
326 return 1
327 }
328 test -f M || {
329 echo "BAD: should have left M intact"
330 return 1
331 }
332 git ls-files -s | grep M && {
333 echo "BAD: M must be untracked in the result"
334 return 1
724b511d 335 }
5b329a5f 336 git reset --hard anchor
724b511d
JH
337'
338
8a359819
AR
339test_expect_success 'merge of identical changes in a renamed file' '
340 rm -f A M N
341 git reset --hard &&
342 git checkout change+rename &&
343 GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" &&
344 git reset --hard HEAD^ &&
345 git checkout change &&
346 GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B"
347'
348
af6e1751
EN
349test_expect_success 'setup for rename + d/f conflicts' '
350 git reset --hard &&
351 git checkout --orphan dir-in-way &&
352 git rm -rf . &&
353
354 mkdir sub &&
355 mkdir dir &&
356 printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >sub/file &&
357 echo foo >dir/file-in-the-way &&
358 git add -A &&
359 git commit -m "Common commmit" &&
360
361 echo 11 >>sub/file &&
362 echo more >>dir/file-in-the-way &&
363 git add -u &&
364 git commit -m "Commit to merge, with dir in the way" &&
365
366 git checkout -b dir-not-in-way &&
367 git reset --soft HEAD^ &&
368 git rm -rf dir &&
369 git commit -m "Commit to merge, with dir removed" -- dir sub/file &&
370
371 git checkout -b renamed-file-has-no-conflicts dir-in-way~1 &&
372 git rm -rf dir &&
373 git rm sub/file &&
374 printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n" >dir &&
375 git add dir &&
376 git commit -m "Independent change" &&
377
378 git checkout -b renamed-file-has-conflicts dir-in-way~1 &&
379 git rm -rf dir &&
380 git mv sub/file dir &&
381 echo 12 >>dir &&
382 git add dir &&
383 git commit -m "Conflicting change"
384'
385
386printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected
387
388test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way' '
389 git reset --hard &&
390 git checkout -q renamed-file-has-no-conflicts^0 &&
391 git merge --strategy=recursive dir-not-in-way &&
392 git diff --quiet &&
393 test -f dir &&
394 test_cmp expected dir
395'
396
397test_expect_failure 'Rename+D/F conflict; renamed file merges but dir in way' '
398 git reset --hard &&
399 rm -rf dir~* &&
400 git checkout -q renamed-file-has-no-conflicts^0 &&
401 test_must_fail git merge --strategy=recursive dir-in-way >output &&
402
403 grep "CONFLICT (delete/modify): dir/file-in-the-way" output &&
404 grep "Auto-merging dir" output &&
405 grep "Adding as dir~HEAD instead" output &&
406
407 test 2 = "$(git ls-files -u | wc -l)" &&
408 test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
409
410 test_must_fail git diff --quiet &&
411 test_must_fail git diff --cached --quiet &&
412
413 test -f dir/file-in-the-way &&
414 test -f dir~HEAD &&
415 test_cmp expected dir~HEAD
416'
417
3398f2f5
EN
418test_expect_failure 'Same as previous, but merged other way' '
419 git reset --hard &&
420 rm -rf dir~* &&
421 git checkout -q dir-in-way^0 &&
422 test_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors &&
423
424 ! grep "error: refusing to lose untracked file at" errors &&
425 grep "CONFLICT (delete/modify): dir/file-in-the-way" output &&
426 grep "Auto-merging dir" output &&
427 grep "Adding as dir~renamed-file-has-no-conflicts instead" output &&
428
429 test 2 = "$(git ls-files -u | wc -l)" &&
430 test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
431
432 test_must_fail git diff --quiet &&
433 test_must_fail git diff --cached --quiet &&
434
435 test -f dir/file-in-the-way &&
436 test -f dir~renamed-file-has-no-conflicts &&
437 test_cmp expected dir~renamed-file-has-no-conflicts
438'
439
af6e1751
EN
440cat >expected <<\EOF &&
4411
4422
4433
4444
4455
4466
4477
4488
4499
45010
451<<<<<<< HEAD
45212
453=======
45411
455>>>>>>> dir-not-in-way
456EOF
457
458test_expect_failure 'Rename+D/F conflict; renamed file cannot merge, dir not in way' '
459 git reset --hard &&
460 rm -rf dir~* &&
461 git checkout -q renamed-file-has-conflicts^0 &&
462 test_must_fail git merge --strategy=recursive dir-not-in-way &&
463
464 test 3 = "$(git ls-files -u | wc -l)" &&
465 test 3 = "$(git ls-files -u dir | wc -l)" &&
466
467 test_must_fail git diff --quiet &&
468 test_must_fail git diff --cached --quiet &&
469
470 test -f dir &&
471 test_cmp expected dir
472'
473
474test_expect_failure 'Rename+D/F conflict; renamed file cannot merge and dir in the way' '
475 modify s/dir-not-in-way/dir-in-way/ expected &&
476
477 git reset --hard &&
478 rm -rf dir~* &&
479 git checkout -q renamed-file-has-conflicts^0 &&
480 test_must_fail git merge --strategy=recursive dir-in-way &&
481
482 test 5 = "$(git ls-files -u | wc -l)" &&
483 test 3 = "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
484 test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
485
486 test_must_fail git diff --quiet &&
487 test_must_fail git diff --cached --quiet &&
488
489 test -f dir/file-in-the-way &&
490 test -f dir~HEAD &&
491 test_cmp expected dir~HEAD
492'
493
3398f2f5
EN
494cat >expected <<\EOF &&
4951
4962
4973
4984
4995
5006
5017
5028
5039
50410
505<<<<<<< HEAD
50611
507=======
50812
509>>>>>>> renamed-file-has-conflicts
510EOF
511
512test_expect_failure 'Same as previous, but merged other way' '
513 git reset --hard &&
514 rm -rf dir~* &&
515 git checkout -q dir-in-way^0 &&
516 test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
517
518 test 5 = "$(git ls-files -u | wc -l)" &&
519 test 3 = "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
520 test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
521
522 test_must_fail git diff --quiet &&
523 test_must_fail git diff --cached --quiet &&
524
525 test -f dir/file-in-the-way &&
526 test -f dir~renamed-file-has-conflicts &&
527 test_cmp expected dir~renamed-file-has-conflicts
528'
529
588504b6
EN
530test_expect_success 'setup both rename source and destination involved in D/F conflict' '
531 git reset --hard &&
532 git checkout --orphan rename-dest &&
533 git rm -rf . &&
534 git clean -fdqx &&
535
536 mkdir one &&
537 echo stuff >one/file &&
538 git add -A &&
539 git commit -m "Common commmit" &&
540
541 git mv one/file destdir &&
542 git commit -m "Renamed to destdir" &&
543
544 git checkout -b source-conflict HEAD~1 &&
545 git rm -rf one &&
546 mkdir destdir &&
547 touch one destdir/foo &&
548 git add -A &&
549 git commit -m "Conflicts in the way"
550'
551
552test_expect_failure 'both rename source and destination involved in D/F conflict' '
553 git reset --hard &&
554 rm -rf dir~* &&
555 git checkout -q rename-dest^0 &&
556 test_must_fail git merge --strategy=recursive source-conflict &&
557
558 test 1 = "$(git ls-files -u | wc -l)" &&
559
560 test_must_fail git diff --quiet &&
561
562 test -f destdir/foo &&
563 test -f one &&
564 test -f destdir~HEAD &&
565 test "stuff" = "$(cat destdir~HEAD)"
566'
567
52304ecd
EN
568test_expect_success 'setup pair rename to parent of other (D/F conflicts)' '
569 git reset --hard &&
570 git checkout --orphan rename-two &&
571 git rm -rf . &&
572 git clean -fdqx &&
573
574 mkdir one &&
575 mkdir two &&
576 echo stuff >one/file &&
577 echo other >two/file &&
578 git add -A &&
579 git commit -m "Common commmit" &&
580
581 git rm -rf one &&
582 git mv two/file one &&
583 git commit -m "Rename two/file -> one" &&
584
585 git checkout -b rename-one HEAD~1 &&
586 git rm -rf two &&
587 git mv one/file two &&
588 rm -r one &&
589 git commit -m "Rename one/file -> two"
590'
591
592test_expect_failure 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
593 git checkout -q rename-one^0 &&
594 mkdir one &&
595 test_must_fail git merge --strategy=recursive rename-two &&
596
597 test 2 = "$(git ls-files -u | wc -l)" &&
598 test 1 = "$(git ls-files -u one | wc -l)" &&
599 test 1 = "$(git ls-files -u two | wc -l)" &&
600
601 test_must_fail git diff --quiet &&
602
603 test 4 = $(find . | grep -v .git | wc -l) &&
604
605 test -d one &&
606 test -f one~rename-two &&
607 test -f two &&
608 test "other" = $(cat one~rename-two) &&
609 test "stuff" = $(cat two)
610'
611
612test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean start' '
613 git reset --hard &&
614 git clean -fdqx &&
615 test_must_fail git merge --strategy=recursive rename-two &&
616
617 test 2 = "$(git ls-files -u | wc -l)" &&
618 test 1 = "$(git ls-files -u one | wc -l)" &&
619 test 1 = "$(git ls-files -u two | wc -l)" &&
620
621 test_must_fail git diff --quiet &&
622
623 test 3 = $(find . | grep -v .git | wc -l) &&
624
625 test -f one &&
626 test -f two &&
627 test "other" = $(cat one) &&
628 test "stuff" = $(cat two)
629'
630
70798348
EN
631test_expect_success 'setup rename of one file to two, with directories in the way' '
632 git reset --hard &&
633 git checkout --orphan first-rename &&
634 git rm -rf . &&
635 git clean -fdqx &&
636
637 echo stuff >original &&
638 git add -A &&
639 git commit -m "Common commmit" &&
640
641 mkdir two &&
642 >two/file &&
643 git add two/file &&
644 git mv original one &&
645 git commit -m "Put two/file in the way, rename to one" &&
646
647 git checkout -b second-rename HEAD~1 &&
648 mkdir one &&
649 >one/file &&
650 git add one/file &&
651 git mv original two &&
652 git commit -m "Put one/file in the way, rename to two"
653'
654
655test_expect_failure 'check handling of differently renamed file with D/F conflicts' '
656 git checkout -q first-rename^0 &&
657 test_must_fail git merge --strategy=recursive second-rename &&
658
659 test 5 = "$(git ls-files -s | wc -l)" &&
660 test 3 = "$(git ls-files -u | wc -l)" &&
661 test 1 = "$(git ls-files -u one | wc -l)" &&
662 test 1 = "$(git ls-files -u two | wc -l)" &&
663 test 1 = "$(git ls-files -u original | wc -l)" &&
664 test 2 = "$(git ls-files -o | wc -l)" &&
665
666 test -f one/file &&
667 test -f two/file &&
668 test -f one~HEAD &&
669 test -f two~second-rename &&
670 ! test -f original
671'
672
673test_expect_success 'setup rename one file to two; directories moving out of the way' '
674 git reset --hard &&
675 git checkout --orphan first-rename-redo &&
676 git rm -rf . &&
677 git clean -fdqx &&
678
679 echo stuff >original &&
680 mkdir one two &&
681 touch one/file two/file &&
682 git add -A &&
683 git commit -m "Common commmit" &&
684
685 git rm -rf one &&
686 git mv original one &&
687 git commit -m "Rename to one" &&
688
689 git checkout -b second-rename-redo HEAD~1 &&
690 git rm -rf two &&
691 git mv original two &&
692 git commit -m "Rename to two"
693'
694
695test_expect_failure 'check handling of differently renamed file with D/F conflicts' '
696 git checkout -q first-rename-redo^0 &&
697 test_must_fail git merge --strategy=recursive second-rename-redo &&
698
699 test 3 = "$(git ls-files -u | wc -l)" &&
700 test 1 = "$(git ls-files -u one | wc -l)" &&
701 test 1 = "$(git ls-files -u two | wc -l)" &&
702 test 1 = "$(git ls-files -u original | wc -l)" &&
703 test 0 = "$(git ls-files -o | wc -l)" &&
704
705 test -f one &&
706 test -f two &&
707 ! test -f original
708'
709
b825e6ff 710test_done