3 test_description="recursive merge corner cases w/ renames but not criss-crosses"
4 # t6036 has corner cases that involve both criss-cross merges and renames
8 test_expect_success 'setup rename/delete + untracked file' '
9 echo "A pretty inscription" >ring &&
12 git commit -m beginning &&
15 git checkout -b rename-the-ring &&
16 git mv ring one-ring-to-rule-them-all &&
18 git commit -m fullname &&
20 git checkout people &&
25 git commit -m track-people-instead-of-objects &&
26 echo "Myyy PRECIOUSSS" >ring
29 test_expect_failure "Does git preserve Gollum's precious artifact?" '
30 test_must_fail git merge -s recursive rename-the-ring &&
32 # Make sure git did not delete an untracked file
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
41 # We should be able to merge B & C cleanly
43 test_expect_success 'setup rename/modify/add-source conflict' '
49 printf "1\n2\n3\n4\n5\n6\n7\n" >a &&
54 git checkout -b B A &&
59 git checkout -b C A &&
61 echo something completely different >a &&
66 test_expect_failure 'rename/modify/add-source conflict resolvable' '
69 git merge -s recursive C^0 &&
71 test $(git rev-parse B:a) = $(git rev-parse b) &&
72 test $(git rev-parse C:a) = $(git rev-parse a)
75 test_expect_success 'setup resolvable conflict missed if rename missed' '
81 printf "1\n2\n3\n4\n5\n" >a &&
87 git checkout -b B A &&
89 echo "Completely different content" >a &&
93 git checkout -b C A &&
99 test_expect_failure 'conflict caused if rename not detected' '
100 git checkout -q C^0 &&
101 git merge -s recursive B^0 &&
103 test 3 -eq $(git ls-files -s | wc -l) &&
104 test 0 -eq $(git ls-files -u | wc -l) &&
105 test 0 -eq $(git ls-files -o | wc -l) &&
107 test 6 -eq $(wc -l < c) &&
108 test $(git rev-parse HEAD:a) = $(git rev-parse B:a) &&
109 test $(git rev-parse HEAD:b) = $(git rev-parse A:b)
112 test_expect_success 'setup conflict resolved wrong if rename missed' '
116 git checkout -b D A &&
120 echo "Completely different content" >a &&
124 git checkout -b E A &&
126 echo "Completely different content" >>a &&
131 test_expect_failure 'missed conflict if rename not detected' '
132 git checkout -q E^0 &&
133 test_must_fail git merge -s recursive D^0