3 test_description='Test cherry-pick with directory/file conflicts'
6 test_expect_success 'Initialize repository' '
13 test_expect_success 'Setup rename across paths each below D/F conflicts' '
15 test_ln_s_add ../a b/a &&
18 git checkout -b branch &&
21 test_ln_s_add b/a a &&
29 test_expect_success 'Cherry-pick succeeds with rename across D/F conflicts' '
31 git checkout master^0 &&
32 git cherry-pick branch
35 test_expect_success 'Setup rename with file on one side matching directory name on other' '
36 git checkout --orphan nick-testcase &&
41 git commit -m "Empty file" &&
43 git checkout -b simple &&
48 git commit -m "Empty file under empty dir" &&
50 echo content >newfile &&
52 git commit -m "New file"
55 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (resolve)' '
57 git checkout -q nick-testcase^0 &&
58 git cherry-pick --strategy=resolve simple
61 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (recursive)' '
63 git checkout -q nick-testcase^0 &&
64 git cherry-pick --strategy=recursive simple
67 test_expect_success 'Setup rename with file on one side matching different dirname on other' '
69 git checkout --orphan mergeme &&
74 echo content > sub/file &&
75 echo foo > othersub/whatever &&
77 git commit -m "Common commmit" &&
79 git rm -rf othersub &&
80 git mv sub/file othersub &&
81 git commit -m "Commit to merge" &&
83 git checkout -b newhead mergeme~1 &&
84 >independent-change &&
85 git add independent-change &&
86 git commit -m "Completely unrelated change"
89 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (resolve)' '
91 git checkout -q newhead^0 &&
92 git cherry-pick --strategy=resolve mergeme
95 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (recursive)' '
97 git checkout -q newhead^0 &&
98 git cherry-pick --strategy=recursive mergeme