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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 11, 2011 at 23:19 UTC 58040239f59004f71d9ae70d0fcd9e0d4f6a3259
1 file changed +39
t/t6042-merge-rename-corner-cases.sh
+39
@@ -33,4 +33,43 @@ test_expect_failure "Does git preserve Gollum's precious artifact?" '
33 test -f ring
34 '
35
36 +# Testcase setup for rename/modify/add-source:
37 +# Commit A: new file: a
38 +# Commit B: modify a slightly
39 +# Commit C: rename a->b, add completely different a
40 +#
41 +# We should be able to merge B & C cleanly
42 +
43 +test_expect_success 'setup rename/modify/add-source conflict' '
44 + git rm -rf . &&
45 + git clean -fdqx &&
46 + rm -rf .git &&
47 + git init &&
48 +
49 + printf "1\n2\n3\n4\n5\n6\n7\n" >a &&
50 + git add a &&
51 + git commit -m A &&
52 + git tag A &&
53 +
54 + git checkout -b B A &&
55 + echo 8 >>a &&
56 + git add a &&
57 + git commit -m B &&
58 +
59 + git checkout -b C A &&
60 + git mv a b &&
61 + echo something completely different >a &&
62 + git add a &&
63 + git commit -m C
64 +'
65 +
66 +test_expect_failure 'rename/modify/add-source conflict resolvable' '
67 + git checkout B^0 &&
68 +
69 + git merge -s recursive C^0 &&
70 +
71 + test $(git rev-parse B:a) = $(git rev-parse b) &&
72 + test $(git rev-parse C:a) = $(git rev-parse a)
73 +'
74 +
75 test_done