notes doc: tidy up `--no-stripspace` paragraph
[git.git] / t / t3509-cherry-pick-merge-df.sh
blobf4159246e1e35d615bca2191393ea19427088dc0
1 #!/bin/sh
3 test_description='Test cherry-pick with directory/file conflicts'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
9 test_expect_success 'Initialize repository' '
10 mkdir a &&
11 >a/f &&
12 git add a &&
13 git commit -m a
16 test_expect_success 'Setup rename across paths each below D/F conflicts' '
17 mkdir b &&
18 test_ln_s_add ../a b/a &&
19 git commit -m b &&
21 git checkout -b branch &&
22 rm b/a &&
23 git mv a b/a &&
24 test_ln_s_add b/a a &&
25 git commit -m swap &&
27 >f1 &&
28 git add f1 &&
29 git commit -m f1
32 test_expect_success 'Cherry-pick succeeds with rename across D/F conflicts' '
33 git reset --hard &&
34 git checkout main^0 &&
35 git cherry-pick branch
38 test_expect_success 'Setup rename with file on one side matching directory name on other' '
39 git checkout --orphan nick-testcase &&
40 git rm -rf . &&
42 >empty &&
43 git add empty &&
44 git commit -m "Empty file" &&
46 git checkout -b simple &&
47 mv empty file &&
48 mkdir empty &&
49 mv file empty &&
50 git add empty/file &&
51 git commit -m "Empty file under empty dir" &&
53 echo content >newfile &&
54 git add newfile &&
55 git commit -m "New file"
58 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (resolve)' '
59 git reset --hard &&
60 git checkout -q nick-testcase^0 &&
61 git cherry-pick --strategy=resolve simple
64 test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (recursive)' '
65 git reset --hard &&
66 git checkout -q nick-testcase^0 &&
67 git cherry-pick --strategy=recursive simple
70 test_expect_success 'Setup rename with file on one side matching different dirname on other' '
71 git reset --hard &&
72 git checkout --orphan mergeme &&
73 git rm -rf . &&
75 mkdir sub &&
76 mkdir othersub &&
77 echo content > sub/file &&
78 echo foo > othersub/whatever &&
79 git add -A &&
80 git commit -m "Common commit" &&
82 git rm -rf othersub &&
83 git mv sub/file othersub &&
84 git commit -m "Commit to merge" &&
86 git checkout -b newhead mergeme~1 &&
87 >independent-change &&
88 git add independent-change &&
89 git commit -m "Completely unrelated change"
92 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (resolve)' '
93 git reset --hard &&
94 git checkout -q newhead^0 &&
95 git cherry-pick --strategy=resolve mergeme
98 test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (recursive)' '
99 git reset --hard &&
100 git checkout -q newhead^0 &&
101 git cherry-pick --strategy=recursive mergeme
104 test_done