t3509: Add rename + D/F conflict testcase that recursive strategy fails
When one side of a file rename matches a directory name on the other side, the recursive merge strategy will fail. This is true even if the merge is trivially resolvable. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Sep 8, 2010 at 00:40 UTC
56bfd762e5e602031eab8ce881b8ab0c50d2cfcc
1 file changed
+66
t/t3509-cherry-pick-merge-df.sh
+66
@@ -32,4 +32,70 @@ test_expect_success SYMLINKS 'Cherry-pick succeeds with rename across D/F confli
32
git cherry-pick branch
33
'
34
35
+test_expect_success 'Setup rename with file on one side matching directory name on other' '
36
+ git checkout --orphan nick-testcase &&
37
+ git rm -rf . &&
38
+
39
+ >empty &&
40
+ git add empty &&
41
+ git commit -m "Empty file" &&
42
+
43
+ git checkout -b simple &&
44
+ mv empty file &&
45
+ mkdir empty &&
46
+ mv file empty &&
47
+ git add empty/file &&
48
+ git commit -m "Empty file under empty dir" &&
49
+
50
+ echo content >newfile &&
51
+ git add newfile &&
52
+ git commit -m "New file"
53
+'
54
+
55
+test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (resolve)' '
56
+ git reset --hard &&
57
+ git checkout -q nick-testcase^0 &&
58
+ git cherry-pick --strategy=resolve simple
59
+'
60
+
61
+test_expect_failure 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (recursive)' '
62
+ git reset --hard &&
63
+ git checkout -q nick-testcase^0 &&
64
+ git cherry-pick --strategy=recursive simple
65
+'
66
+
67
+test_expect_success 'Setup rename with file on one side matching different dirname on other' '
68
+ git reset --hard &&
69
+ git checkout --orphan mergeme &&
70
+ git rm -rf . &&
71
+
72
+ mkdir sub &&
73
+ mkdir othersub &&
74
+ echo content > sub/file &&
75
+ echo foo > othersub/whatever &&
76
+ git add -A &&
77
+ git commit -m "Common commmit" &&
78
+
79
+ git rm -rf othersub &&
80
+ git mv sub/file othersub &&
81
+ git commit -m "Commit to merge" &&
82
+
83
+ git checkout -b newhead mergeme~1 &&
84
+ >independent-change &&
85
+ git add independent-change &&
86
+ git commit -m "Completely unrelated change"
87
+'
88
+
89
+test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (resolve)' '
90
+ git reset --hard &&
91
+ git checkout -q newhead^0 &&
92
+ git cherry-pick --strategy=resolve mergeme
93
+'
94
+
95
+test_expect_failure 'Cherry-pick with rename to different D/F conflict succeeds (recursive)' '
96
+ git reset --hard &&
97
+ git checkout -q newhead^0 &&
98
+ git cherry-pick --strategy=recursive mergeme
99
+'
100
+
101
test_done