diff options
author | Junio C Hamano <junkio@cox.net> | 2007-02-16 22:43:48 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-16 22:56:06 -0800 |
commit | 185c975faaa790a98a4e00f124461473283500d6 (patch) | |
tree | 093c04e201a8bbddfbe2e22b734a458a9505a0ec /t/t3700-add.sh | |
parent | git-blame: prevent argument parsing segfault (diff) | |
download | tgif-185c975faaa790a98a4e00f124461473283500d6.tar.xz |
Do not take mode bits from index after type change.
When we do not trust executable bit from lstat(2), we copied
existing ce_mode bits without checking if the filesystem object
is a regular file (which is the only thing we apply the "trust
executable bit" business) nor if the blob in the index is a
regular file (otherwise, we should do the same as registering a
new regular file, which is to default non-executable).
Noticed by Johannes Sixt.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t3700-add.sh')
-rwxr-xr-x | t/t3700-add.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t3700-add.sh b/t/t3700-add.sh index caaab26c2f..08e035220c 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -30,6 +30,16 @@ test_expect_success \ *) echo fail; git-ls-files --stage xfoo1; (exit 1);; esac' +test_expect_success 'git-add: filemode=0 should not get confused by symlink' ' + rm -f xfoo1 && + ln -s foo xfoo1 && + git-add xfoo1 && + case "`git-ls-files --stage xfoo1`" in + 120000" "*xfoo1) echo ok;; + *) echo fail; git-ls-files --stage xfoo1; (exit 1);; + esac +' + test_expect_success \ 'git-update-index --add: Test that executable bit is not used...' \ 'git config core.filemode 0 && @@ -41,6 +51,16 @@ test_expect_success \ *) echo fail; git-ls-files --stage xfoo2; (exit 1);; esac' +test_expect_success 'git-add: filemode=0 should not get confused by symlink' ' + rm -f xfoo2 && + ln -s foo xfoo2 && + git update-index --add xfoo2 && + case "`git-ls-files --stage xfoo2`" in + 120000" "*xfoo2) echo ok;; + *) echo fail; git-ls-files --stage xfoo2; (exit 1);; + esac +' + test_expect_success \ 'git-update-index --add: Test that executable bit is not used...' \ 'git config core.filemode 0 && |