]>
Commit | Line | Data |
---|---|---|
f433f705 AG |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test cherry-pick with directory/file conflicts' | |
4 | . ./test-lib.sh | |
5 | ||
899663f8 | 6 | test_expect_success 'Initialize repository' ' |
f433f705 AG |
7 | mkdir a && |
8 | >a/f && | |
9 | git add a && | |
899663f8 PT |
10 | git commit -m a |
11 | ' | |
f433f705 | 12 | |
899663f8 | 13 | test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' ' |
f433f705 AG |
14 | mkdir b && |
15 | ln -s ../a b/a && | |
16 | git add b && | |
17 | git commit -m b && | |
18 | ||
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 && | |
25 | ||
26 | >f1 && | |
27 | git add f1 && | |
28 | git commit -m f1 | |
29 | ' | |
30 | ||
dd568581 | 31 | test_expect_success SYMLINKS 'Cherry-pick succeeds with rename across D/F conflicts' ' |
f433f705 AG |
32 | git reset --hard && |
33 | git checkout master^0 && | |
34 | git cherry-pick branch | |
35 | ' | |
36 | ||
56bfd762 EN |
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 . && | |
40 | ||
41 | >empty && | |
42 | git add empty && | |
43 | git commit -m "Empty file" && | |
44 | ||
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" && | |
51 | ||
52 | echo content >newfile && | |
53 | git add newfile && | |
54 | git commit -m "New file" | |
55 | ' | |
56 | ||
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 | |
61 | ' | |
62 | ||
86273e57 | 63 | test_expect_success 'Cherry-pick succeeds with was_a_dir/file -> was_a_dir (recursive)' ' |
56bfd762 EN |
64 | git reset --hard && |
65 | git checkout -q nick-testcase^0 && | |
66 | git cherry-pick --strategy=recursive simple | |
67 | ' | |
68 | ||
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 . && | |
73 | ||
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" && | |
80 | ||
81 | git rm -rf othersub && | |
82 | git mv sub/file othersub && | |
83 | git commit -m "Commit to merge" && | |
84 | ||
85 | git checkout -b newhead mergeme~1 && | |
86 | >independent-change && | |
87 | git add independent-change && | |
88 | git commit -m "Completely unrelated change" | |
89 | ' | |
90 | ||
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 | |
95 | ' | |
96 | ||
86273e57 | 97 | test_expect_success 'Cherry-pick with rename to different D/F conflict succeeds (recursive)' ' |
56bfd762 EN |
98 | git reset --hard && |
99 | git checkout -q newhead^0 && | |
100 | git cherry-pick --strategy=recursive mergeme | |
101 | ' | |
102 | ||
f433f705 | 103 | test_done |