summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-01-16 05:48:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-16 05:48:45 (GMT)
commit8dbabb31dfcda172b8220ba6ebce3e8938dc1df3 (patch)
treefb558a315517f1e9d84235b9ae1120d3423905e8 /t
parentb2ace18759c4a103eecb3f5f86a098f53c71fe01 (diff)
parentea8bbf2a4eb6632115e2caefc59e28715f8d5e22 (diff)
downloadgit-8dbabb31dfcda172b8220ba6ebce3e8938dc1df3.zip
git-8dbabb31dfcda172b8220ba6ebce3e8938dc1df3.tar.gz
git-8dbabb31dfcda172b8220ba6ebce3e8938dc1df3.tar.bz2
Merge branch 'mt/t4129-with-setgid-dir'
Some tests expect that "ls -l" output has either '-' or 'x' for group executable bit, but setgid bit can be inherited from parent directory and make these fields 'S' or 's' instead, causing test failures. * mt/t4129-with-setgid-dir: t4129: don't fail if setgid is set in the test directory
Diffstat (limited to 't')
-rw-r--r--t/test-lib-functions.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 999982f..2f08ce7 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -367,9 +367,14 @@ test_chmod () {
git update-index --add "--chmod=$@"
}
-# Get the modebits from a file or directory.
+# Get the modebits from a file or directory, ignoring the setgid bit (g+s).
+# This bit is inherited by subdirectories at their creation. So we remove it
+# from the returning string to prevent callers from having to worry about the
+# state of the bit in the test directory.
+#
test_modebits () {
- ls -ld "$1" | sed -e 's|^\(..........\).*|\1|'
+ ls -ld "$1" | sed -e 's|^\(..........\).*|\1|' \
+ -e 's|^\(......\)S|\1-|' -e 's|^\(......\)s|\1x|'
}
# Unset a configuration variable, but don't fail if it doesn't exist.