Skip to content

Commit 8a785dc

Browse files
committed
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>
1 parent 8d14ac9 commit 8a785dc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

t/t1004-read-tree-m-u-wf.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,41 @@ test_expect_success '3-way not overwriting local changes (their side)' '
157157
158158
'
159159

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+
160195
test_expect_success 'D/F setup' '
161196
162197
git reset --hard &&

0 commit comments

Comments
 (0)