33test_description=' merging when a directory was replaced with a symlink'
44. ./test-lib.sh
55
6- test_expect_success SYMLINKS ' create a commit where dir a/b changed to symlink' '
6+ test_expect_success ' create a commit where dir a/b changed to symlink' '
77 mkdir -p a/b/c a/b-2/c &&
88 > a/b/c/d &&
99 > a/b-2/c/d &&
@@ -12,20 +12,20 @@ test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink'
1212 git commit -m base &&
1313 git tag start &&
1414 rm -rf a/b &&
15- ln -s b-2 a/b &&
1615 git add -A &&
16+ test_ln_s_add b-2 a/b &&
1717 git commit -m "dir to symlink"
1818'
1919
20- test_expect_success SYMLINKS ' checkout does not clobber untracked symlink' '
20+ test_expect_success ' checkout does not clobber untracked symlink' '
2121 git checkout HEAD^0 &&
2222 git reset --hard master &&
2323 git rm --cached a/b &&
2424 git commit -m "untracked symlink remains" &&
2525 test_must_fail git checkout start^0
2626'
2727
28- test_expect_success SYMLINKS ' a/b-2/c/d is kept when clobbering symlink b' '
28+ test_expect_success ' a/b-2/c/d is kept when clobbering symlink b' '
2929 git checkout HEAD^0 &&
3030 git reset --hard master &&
3131 git rm --cached a/b &&
@@ -34,14 +34,14 @@ test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' '
3434 test -f a/b-2/c/d
3535'
3636
37- test_expect_success SYMLINKS ' checkout should not have deleted a/b-2/c/d' '
37+ test_expect_success ' checkout should not have deleted a/b-2/c/d' '
3838 git checkout HEAD^0 &&
3939 git reset --hard master &&
4040 git checkout start^0 &&
4141 test -f a/b-2/c/d
4242'
4343
44- test_expect_success SYMLINKS ' setup for merge test' '
44+ test_expect_success ' setup for merge test' '
4545 git reset --hard &&
4646 test -f a/b-2/c/d &&
4747 echo x > a/x &&
@@ -50,39 +50,51 @@ test_expect_success SYMLINKS 'setup for merge test' '
5050 git tag baseline
5151'
5252
53- test_expect_success SYMLINKS ' Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
53+ test_expect_success ' Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
5454 git reset --hard &&
5555 git checkout baseline^0 &&
5656 git merge -s resolve master &&
57- test -h a/b &&
5857 test -f a/b-2/c/d
5958'
6059
61- test_expect_success SYMLINKS ' Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
60+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
61+ test -h a/b
62+ '
63+
64+ test_expect_success ' Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
6265 git reset --hard &&
6366 git checkout baseline^0 &&
6467 git merge -s recursive master &&
65- test -h a/b &&
6668 test -f a/b-2/c/d
6769'
6870
69- test_expect_success SYMLINKS ' Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
71+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
72+ test -h a/b
73+ '
74+
75+ test_expect_success ' Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
7076 git reset --hard &&
7177 git checkout master^0 &&
7278 git merge -s resolve baseline^0 &&
73- test -h a/b &&
7479 test -f a/b-2/c/d
7580'
7681
77- test_expect_success SYMLINKS ' Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
82+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
83+ test -h a/b
84+ '
85+
86+ test_expect_success ' Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
7887 git reset --hard &&
7988 git checkout master^0 &&
8089 git merge -s recursive baseline^0 &&
81- test -h a/b &&
8290 test -f a/b-2/c/d
8391'
8492
85- test_expect_failure SYMLINKS ' do not lose untracked in merge (resolve)' '
93+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
94+ test -h a/b
95+ '
96+
97+ test_expect_failure ' do not lose untracked in merge (resolve)' '
8698 git reset --hard &&
8799 git checkout baseline^0 &&
88100 >a/b/c/e &&
@@ -91,7 +103,7 @@ test_expect_failure SYMLINKS 'do not lose untracked in merge (resolve)' '
91103 test -f a/b-2/c/d
92104'
93105
94- test_expect_success SYMLINKS ' do not lose untracked in merge (recursive)' '
106+ test_expect_success ' do not lose untracked in merge (recursive)' '
95107 git reset --hard &&
96108 git checkout baseline^0 &&
97109 >a/b/c/e &&
@@ -100,52 +112,61 @@ test_expect_success SYMLINKS 'do not lose untracked in merge (recursive)' '
100112 test -f a/b-2/c/d
101113'
102114
103- test_expect_success SYMLINKS ' do not lose modifications in merge (resolve)' '
115+ test_expect_success ' do not lose modifications in merge (resolve)' '
104116 git reset --hard &&
105117 git checkout baseline^0 &&
106118 echo more content >>a/b/c/d &&
107119 test_must_fail git merge -s resolve master
108120'
109121
110- test_expect_success SYMLINKS ' do not lose modifications in merge (recursive)' '
122+ test_expect_success ' do not lose modifications in merge (recursive)' '
111123 git reset --hard &&
112124 git checkout baseline^0 &&
113125 echo more content >>a/b/c/d &&
114126 test_must_fail git merge -s recursive master
115127'
116128
117- test_expect_success SYMLINKS ' setup a merge where dir a/b-2 changed to symlink' '
129+ test_expect_success ' setup a merge where dir a/b-2 changed to symlink' '
118130 git reset --hard &&
119131 git checkout start^0 &&
120132 rm -rf a/b-2 &&
121- ln -s b a/b-2 &&
122133 git add -A &&
134+ test_ln_s_add b a/b-2 &&
123135 git commit -m "dir a/b-2 to symlink" &&
124136 git tag test2
125137'
126138
127- test_expect_success SYMLINKS ' merge should not have D/F conflicts (resolve)' '
139+ test_expect_success ' merge should not have D/F conflicts (resolve)' '
128140 git reset --hard &&
129141 git checkout baseline^0 &&
130142 git merge -s resolve test2 &&
131- test -h a/b-2 &&
132143 test -f a/b/c/d
133144'
134145
135- test_expect_success SYMLINKS ' merge should not have D/F conflicts (recursive)' '
146+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
147+ test -h a/b-2
148+ '
149+
150+ test_expect_success ' merge should not have D/F conflicts (recursive)' '
136151 git reset --hard &&
137152 git checkout baseline^0 &&
138153 git merge -s recursive test2 &&
139- test -h a/b-2 &&
140154 test -f a/b/c/d
141155'
142156
143- test_expect_success SYMLINKS ' merge should not have F/D conflicts (recursive)' '
157+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
158+ test -h a/b-2
159+ '
160+
161+ test_expect_success ' merge should not have F/D conflicts (recursive)' '
144162 git reset --hard &&
145163 git checkout -b foo test2 &&
146164 git merge -s recursive baseline^0 &&
147- test -h a/b-2 &&
148165 test -f a/b/c/d
149166'
150167
168+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
169+ test -h a/b-2
170+ '
171+
151172test_done
0 commit comments