@matheusbsbs / matheus-bagliano / commits / 8a785dc921
Fork 0

Add tests to catch problems with un-unlinkable symlinks

This currently fails not because we refuse to check out, but because we detect error but incorrectly discard it in the callchain. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 18, 2008 at 21:59 UTC 8a785dc921386dac628a2a04ebe5f48deb7cc1a8
1 file changed +35
t/t1004-read-tree-m-u-wf.sh
+35
@@ -157,6 +157,41 @@ test_expect_success '3-way not overwriting local changes (their side)' '
157
158 '
159
160 +test_expect_success 'funny symlink in work tree' '
161 +
162 + git reset --hard &&
163 + git checkout -b sym-b side-b &&
164 + mkdir -p a &&
165 + >a/b &&
166 + git add a/b &&
167 + git commit -m "side adds a/b" &&
168 +
169 + rm -fr a &&
170 + git checkout -b sym-a side-a &&
171 + mkdir -p a &&
172 + ln -s ../b a/b &&
173 + git add a/b &&
174 + git commit -m "we add a/b" &&
175 +
176 + git read-tree -m -u sym-a sym-a sym-b
177 +
178 +'
179 +
180 +test_expect_failure 'funny symlink in work tree, un-unlink-able' '
181 +
182 + rm -fr a b &&
183 + git reset --hard &&
184 +
185 + git checkout sym-a &&
186 + chmod a-w a &&
187 + test_must_fail git read-tree -m -u sym-a sym-a sym-b
188 +
189 +'
190 +
191 +# clean-up from the above test
192 +chmod a+w a
193 +rm -fr a b
194 +
195 test_expect_success 'D/F setup' '
196
197 git reset --hard &&