-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |