OSDN Git Service

t6042: Add failing testcase for rename/modify/add-source conflict
authorElijah Newren <newren@gmail.com>
Fri, 12 Aug 2011 05:19:35 +0000 (23:19 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sun, 14 Aug 2011 21:19:31 +0000 (14:19 -0700)
If there is a cleanly resolvable rename/modify conflict AND there is a new
file introduced on the renamed side of the merge whose name happens to
match that of the source of the rename (but is otherwise unrelated to the
rename), then git fails to cleanly resolve the merge despite the fact that
the new file should not cause any problems.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6042-merge-rename-corner-cases.sh

index 5054459..276d7dd 100755 (executable)
@@ -33,4 +33,43 @@ test_expect_failure "Does git preserve Gollum's precious artifact?" '
        test -f ring
 '
 
+# Testcase setup for rename/modify/add-source:
+#   Commit A: new file: a
+#   Commit B: modify a slightly
+#   Commit C: rename a->b, add completely different a
+#
+# We should be able to merge B & C cleanly
+
+test_expect_success 'setup rename/modify/add-source conflict' '
+       git rm -rf . &&
+       git clean -fdqx &&
+       rm -rf .git &&
+       git init &&
+
+       printf "1\n2\n3\n4\n5\n6\n7\n" >a &&
+       git add a &&
+       git commit -m A &&
+       git tag A &&
+
+       git checkout -b B A &&
+       echo 8 >>a &&
+       git add a &&
+       git commit -m B &&
+
+       git checkout -b C A &&
+       git mv a b &&
+       echo something completely different >a &&
+       git add a &&
+       git commit -m C
+'
+
+test_expect_failure 'rename/modify/add-source conflict resolvable' '
+       git checkout B^0 &&
+
+       git merge -s recursive C^0 &&
+
+       test $(git rev-parse B:a) = $(git rev-parse b) &&
+       test $(git rev-parse C:a) = $(git rev-parse a)
+'
+
 test_done