Merge branch 'mg/maint-difftool-vim-readonly' into maint
[git/jnareb-git.git] / t / t3509-cherry-pick-merge-df.sh
blobdf921d1f33df34dd2b2631580f8d53b18270662a
1 #!/bin/sh
3 test_description='Test cherry-pick with directory/file conflicts'
4 . ./test-lib.sh
6 test_expect_success 'Initialize repository' '
7 mkdir a &&
8 >a/f &&
9 git add a &&
10 git commit -m a
13 test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
14 mkdir b &&
15 ln -s ../a b/a &&
16 git add b &&
17 git commit -m b &&
19 git checkout -b branch &&
20 rm b/a &&
21 mv a b/a &&
22 ln -s b/a a &&
23 git add . &&
24 git commit -m swap &&
26 >f1 &&
27 git add f1 &&
28 git commit -m f1
31 test_expect_success SYMLINKS 'Cherry-pick succeeds with rename across D/F conflicts' '
32 git reset --hard &&
33 git checkout master^0 &&
34 git cherry-pick branch
37 test_expect_success 'Setup rename with file on one side matching directory name on other' '
38 git checkout --orphan nick-testcase &&
39 git rm -rf . &&
41 >empty &&
42 git add empty &&
43 git commit -m "Empty file" &&
45 git checkout -b simple &&
46 mv empty file &&
47 mkdir empty &&
48 mv file empty &&
49 git add empty/file &&
50 git commit -m "Empty file under empty dir" &&
52 echo content >newfile &&
53 git add newfile &&
54 git commit -m "New file"
57 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (resolve)' '
58 git reset --hard &&
59 git checkout -q nick-testcase^0 &&
60 git cherry-pick --strategy=resolve simple
63 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (recursive)' '
64 git reset --hard &&
65 git checkout -q nick-testcase^0 &&
66 git cherry-pick --strategy=recursive simple
69 test_expect_success 'Setup rename with file on one side matching different dirname on other' '
70 git reset --hard &&
71 git checkout --orphan mergeme &&
72 git rm -rf . &&
74 mkdir sub &&
75 mkdir othersub &&
76 echo content > sub/file &&
77 echo foo > othersub/whatever &&
78 git add -A &&
79 git commit -m "Common commmit" &&
81 git rm -rf othersub &&
82 git mv sub/file othersub &&
83 git commit -m "Commit to merge" &&
85 git checkout -b newhead mergeme~1 &&
86 >independent-change &&
87 git add independent-change &&
88 git commit -m "Completely unrelated change"
91 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (resolve)' '
92 git reset --hard &&
93 git checkout -q newhead^0 &&
94 git cherry-pick --strategy=resolve mergeme
97 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (recursive)' '
98 git reset --hard &&
99 git checkout -q newhead^0 &&
100 git cherry-pick --strategy=recursive mergeme
103 test_done