t6022: Add tests with both rename source & dest involved in D/F conflicts
Having the source of a rename be involved in a directory/file conflict does not currently pose any difficulties to the current merge-recursive algorithm (in contrast to destinations of renames and D/F conflicts). However, combining the two seemed like good testcases to include for completeness. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Sep 20, 2010 at 02:28 UTC
588504b694133cba85982fbace532d2156f859eb
1 file changed
+38
t/t6022-merge-rename.sh
+38
@@ -527,4 +527,42 @@ test_expect_failure 'Same as previous, but merged other way' '
527
test_cmp expected dir~renamed-file-has-conflicts
528
'
529
530
+test_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
+
552
+test_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
+
568
test_done