From: Elijah Newren Date: Fri, 12 Aug 2011 05:19:35 +0000 (-0600) Subject: t6042: Add failing testcase for rename/modify/add-source conflict X-Git-Tag: v1.7.7-rc1~28^2~55 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/58040239f59004f71d9ae70d0fcd9e0d4f6a3259?hp=695576fddd039b2fdc3cad52bbaab4d89e27b71c t6042: Add failing testcase for rename/modify/add-source conflict 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 Signed-off-by: Junio C Hamano --- diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh index 5054459987..276d7dd2d7 100755 --- a/t/t6042-merge-rename-corner-cases.sh +++ b/t/t6042-merge-rename-corner-cases.sh @@ -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