diff options
author | Johannes Sixt <j6t@kdbg.org> | 2009-02-28 21:12:57 +0100 |
---|---|---|
committer | Johannes Sixt <j6t@kdbg.org> | 2009-03-19 21:47:14 +0100 |
commit | 1f553918a8482ea792e8cd4d5d2c75fe60f68aae (patch) | |
tree | 1227021499212fafc4d70e2030813598f68292c0 /t/test-lib.sh | |
parent | 8586f98bd29bd4ad3d0e62a3be4a4d59ff8b27cd (diff) | |
download | git-1f553918a8482ea792e8cd4d5d2c75fe60f68aae.tar.gz |
test-lib: Introduce test_chmod and use it instead of update-index --chmod
This function replaces sequences of 'chmod +x' and 'git update-index
--chmod=+x' in the test suite, whose purpose is to help filesystems
that need core.filemode=false. Two places where only 'chmod +x' was used
we also use this new function.
The function calls 'git update-index --chmod' without checking
core.filemode (unlike some of the call sites did). We do this because the
call sites *expect* that the executable bit ends up in the index (ie. it
is not the purpose of the call sites to *test* whether git treats
'chmod +x' and 'update-index --chmod=+x' correctly). Therefore, on
filesystems with core.filemode=true the 'git update-index --chmod' is a
no-op.
The function uses --add with update-index to help one call site in
t6031-merge-recursive. It makes no difference for the other callers.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index ace440cb36..638cca41e3 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -238,6 +238,15 @@ test_merge () { git tag "$1" } +# This function helps systems where core.filemode=false is set. +# Use it instead of plain 'chmod +x' to set or unset the executable bit +# of a file in the working directory and add it to the index. + +test_chmod () { + chmod "$@" && + git update-index --add "--chmod=$@" +} + # You are not expected to call test_ok_ and test_failure_ directly, use # the text_expect_* functions instead. |