]>
Commit | Line | Data |
---|---|---|
4f6339b0 PJ |
1 | #!/bin/sh |
2 | ||
3 | test_description='merging when a directory was replaced with a symlink' | |
4 | . ./test-lib.sh | |
5 | ||
41be8ea2 | 6 | test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' ' |
4f6339b0 PJ |
7 | mkdir -p a/b/c a/b-2/c && |
8 | > a/b/c/d && | |
9 | > a/b-2/c/d && | |
10 | > a/x && | |
11 | git add -A && | |
12 | git commit -m base && | |
13 | git tag start && | |
14 | rm -rf a/b && | |
15 | ln -s b-2 a/b && | |
16 | git add -A && | |
17 | git commit -m "dir to symlink" | |
18 | ' | |
19 | ||
1d718a51 | 20 | test_expect_success SYMLINKS 'checkout does not clobber untracked symlink' ' |
4f6339b0 PJ |
21 | git checkout HEAD^0 && |
22 | git reset --hard master && | |
23 | git rm --cached a/b && | |
24 | git commit -m "untracked symlink remains" && | |
1d718a51 CB |
25 | test_must_fail git checkout start^0 |
26 | ' | |
27 | ||
28 | test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' ' | |
29 | git checkout HEAD^0 && | |
30 | git reset --hard master && | |
31 | git rm --cached a/b && | |
32 | git commit -m "untracked symlink remains" && | |
33 | git checkout -f start^0 && | |
34 | test -f a/b-2/c/d | |
4f6339b0 PJ |
35 | ' |
36 | ||
41be8ea2 | 37 | test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' ' |
4f6339b0 PJ |
38 | git checkout HEAD^0 && |
39 | git reset --hard master && | |
40 | git checkout start^0 && | |
41 | test -f a/b-2/c/d | |
42 | ' | |
43 | ||
41be8ea2 | 44 | test_expect_success SYMLINKS 'setup for merge test' ' |
4f6339b0 PJ |
45 | git reset --hard && |
46 | test -f a/b-2/c/d && | |
47 | echo x > a/x && | |
48 | git add a/x && | |
49 | git commit -m x && | |
50 | git tag baseline | |
51 | ' | |
52 | ||
a2c67264 | 53 | test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' ' |
4f6339b0 PJ |
54 | git reset --hard && |
55 | git checkout baseline^0 && | |
56 | git merge -s resolve master && | |
57 | test -h a/b && | |
58 | test -f a/b-2/c/d | |
59 | ' | |
60 | ||
a2c67264 | 61 | test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' ' |
4f6339b0 PJ |
62 | git reset --hard && |
63 | git checkout baseline^0 && | |
64 | git merge -s recursive master && | |
65 | test -h a/b && | |
66 | test -f a/b-2/c/d | |
67 | ' | |
68 | ||
a2c67264 | 69 | test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' ' |
f15652d9 EN |
70 | git reset --hard && |
71 | git checkout master^0 && | |
72 | git merge -s resolve baseline^0 && | |
73 | test -h a/b && | |
74 | test -f a/b-2/c/d | |
75 | ' | |
76 | ||
a2c67264 | 77 | test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' ' |
f15652d9 EN |
78 | git reset --hard && |
79 | git checkout master^0 && | |
80 | git merge -s recursive baseline^0 && | |
81 | test -h a/b && | |
82 | test -f a/b-2/c/d | |
83 | ' | |
84 | ||
a2c67264 | 85 | test_expect_failure SYMLINKS 'do not lose untracked in merge (resolve)' ' |
f15652d9 EN |
86 | git reset --hard && |
87 | git checkout baseline^0 && | |
88 | >a/b/c/e && | |
89 | test_must_fail git merge -s resolve master && | |
90 | test -f a/b/c/e && | |
91 | test -f a/b-2/c/d | |
92 | ' | |
93 | ||
a2c67264 | 94 | test_expect_success SYMLINKS 'do not lose untracked in merge (recursive)' ' |
f15652d9 EN |
95 | git reset --hard && |
96 | git checkout baseline^0 && | |
97 | >a/b/c/e && | |
98 | test_must_fail git merge -s recursive master && | |
99 | test -f a/b/c/e && | |
100 | test -f a/b-2/c/d | |
101 | ' | |
102 | ||
a2c67264 | 103 | test_expect_success SYMLINKS 'do not lose modifications in merge (resolve)' ' |
f15652d9 EN |
104 | git reset --hard && |
105 | git checkout baseline^0 && | |
106 | echo more content >>a/b/c/d && | |
107 | test_must_fail git merge -s resolve master | |
108 | ' | |
109 | ||
a2c67264 | 110 | test_expect_success SYMLINKS 'do not lose modifications in merge (recursive)' ' |
f15652d9 EN |
111 | git reset --hard && |
112 | git checkout baseline^0 && | |
113 | echo more content >>a/b/c/d && | |
114 | test_must_fail git merge -s recursive master | |
115 | ' | |
116 | ||
41be8ea2 | 117 | test_expect_success SYMLINKS 'setup a merge where dir a/b-2 changed to symlink' ' |
4f6339b0 PJ |
118 | git reset --hard && |
119 | git checkout start^0 && | |
120 | rm -rf a/b-2 && | |
121 | ln -s b a/b-2 && | |
122 | git add -A && | |
123 | git commit -m "dir a/b-2 to symlink" && | |
124 | git tag test2 | |
125 | ' | |
126 | ||
a2c67264 | 127 | test_expect_success SYMLINKS 'merge should not have D/F conflicts (resolve)' ' |
4f6339b0 PJ |
128 | git reset --hard && |
129 | git checkout baseline^0 && | |
130 | git merge -s resolve test2 && | |
131 | test -h a/b-2 && | |
132 | test -f a/b/c/d | |
133 | ' | |
134 | ||
a2c67264 | 135 | test_expect_success SYMLINKS 'merge should not have D/F conflicts (recursive)' ' |
4f6339b0 PJ |
136 | git reset --hard && |
137 | git checkout baseline^0 && | |
138 | git merge -s recursive test2 && | |
139 | test -h a/b-2 && | |
140 | test -f a/b/c/d | |
141 | ' | |
142 | ||
a2c67264 | 143 | test_expect_success SYMLINKS 'merge should not have F/D conflicts (recursive)' ' |
f15652d9 EN |
144 | git reset --hard && |
145 | git checkout -b foo test2 && | |
146 | git merge -s recursive baseline^0 && | |
147 | test -h a/b-2 && | |
148 | test -f a/b/c/d | |
149 | ' | |
150 | ||
4f6339b0 | 151 | test_done |