summaryrefslogtreecommitdiff
path: root/t/t0055-beyond-symlinks.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-04 07:51:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-05 06:31:23 (GMT)
commit806d13b1ccdbdde4bbdfb96902791c4b7ed125f6 (patch)
tree139db78f9efdb5f588c1b504b0dc8700d9d9039c /t/t0055-beyond-symlinks.sh
parentfba5279db904aa49bb75bb31614571b9b6d75b33 (diff)
downloadgit-806d13b1ccdbdde4bbdfb96902791c4b7ed125f6.zip
git-806d13b1ccdbdde4bbdfb96902791c4b7ed125f6.tar.gz
git-806d13b1ccdbdde4bbdfb96902791c4b7ed125f6.tar.bz2
update-index: refuse to add working tree items beyond symlinks
When "sym" is a symbolic link that is inside the working tree, and it points at a directory "dir" that has "path" in it, "update-index --add sym/path" used to mistakenly add "sym/path" as if "sym" were a normal directory. "git apply", "git diff" and "git merge" have been taught about this issue some time ago, but "update-index" and "add" have been left ignorant for too long. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0055-beyond-symlinks.sh')
-rwxr-xr-xt/t0055-beyond-symlinks.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t0055-beyond-symlinks.sh b/t/t0055-beyond-symlinks.sh
new file mode 100755
index 0000000..eb11dd7
--- /dev/null
+++ b/t/t0055-beyond-symlinks.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='update-index refuses to add beyond symlinks'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ >a &&
+ mkdir b &&
+ ln -s b c &&
+ >c/d &&
+ git update-index --add a b/d
+'
+
+test_expect_success 'update-index --add beyond symlinks' '
+ test_must_fail git update-index --add c/d &&
+ ! ( git ls-files | grep c/d )
+'
+
+test_done