summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-03-30 14:35:36 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-30 14:35:36 -0700
commit9210c68d2af84d869f1635efe9a2092578653297 (patch)
tree3967574291f29eca2c480266658e2d4185370d66 /t
parentSync with v2.31.1 (diff)
parentcheckout: don't follow symlinks when removing entries (diff)
downloadtgif-9210c68d2af84d869f1635efe9a2092578653297.tar.xz
Merge branch 'mt/checkout-remove-nofollow'
When "git checkout" removes a path that does not exist in the commit it is checking out, it wasn't careful enough not to follow symbolic links, which has been corrected. * mt/checkout-remove-nofollow: checkout: don't follow symlinks when removing entries symlinks: update comment on threaded_check_leading_path()
Diffstat (limited to 't')
-rwxr-xr-xt/t2021-checkout-overwrite.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
index c2ada7de37..70d69263e6 100755
--- a/t/t2021-checkout-overwrite.sh
+++ b/t/t2021-checkout-overwrite.sh
@@ -51,4 +51,16 @@ test_expect_success SYMLINKS 'the symlink remained' '
test -h a/b
'
+test_expect_success SYMLINKS 'checkout -f must not follow symlinks when removing entries' '
+ git checkout -f start &&
+ mkdir dir &&
+ >dir/f &&
+ git add dir/f &&
+ git commit -m "add dir/f" &&
+ mv dir untracked &&
+ ln -s untracked dir &&
+ git checkout -f HEAD~ &&
+ test_path_is_file untracked/f
+'
+
test_done