summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 41a4d16)
raw | patch | inline | side by side (parent: 41a4d16)
author | Johannes Schindelin <johannes.schindelin@gmx.de> | |
Thu, 29 Jan 2009 16:30:51 +0000 (17:30 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 31 Jan 2009 05:11:24 +0000 (21:11 -0800) |
When trying to find out mode changes, we should not access the symlink
targets using stat(); instead we use lstat() so that the diff does
not fail trying to find a non-existing symlink target.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
targets using stat(); instead we use lstat() so that the diff does
not fail trying to find a non-existing symlink target.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index.c | patch | blob | history | |
t/t4011-diff-symlink.sh | patch | blob | history |
diff --git a/diff-no-index.c b/diff-no-index.c
index 60ed17470a6a2bf9bea202a04004b06d207a77d7..0dbd9dad8b100cdd4918571636ad3e9a1a0a2abf 100644 (file)
--- a/diff-no-index.c
+++ b/diff-no-index.c
*mode = 0;
else if (!strcmp(path, "-"))
*mode = create_ce_mode(0666);
- else if (stat(path, &st))
+ else if (lstat(path, &st))
return error("Could not access '%s'", path);
else
*mode = st.st_mode;
index 02efecae3ad06e5a62553e990fc0934dd0c65eab..9055c8b318aa8cfa8b89fd19b20e94a7435ee155 100755 (executable)
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
git diff-index -M -p $tree > current &&
compare_diff_patch current expected'
+test_expect_success \
+ 'diff symlinks with non-existing targets' \
+ 'ln -s narf pinky &&
+ ln -s take\ over brain &&
+ test_must_fail git diff --no-index pinky brain > output 2> output.err &&
+ grep narf output &&
+ ! grep error output.err'
test_done