Skip to content

Commit 801e896

Browse files
committed
Merge branch 'mt/t4129-with-setgid-dir' into maint
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
2 parents a4031f6 + ea8bbf2 commit 801e896

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/test-lib-functions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,14 @@ test_chmod () {
367367
git update-index --add "--chmod=$@"
368368
}
369369

370-
# Get the modebits from a file or directory.
370+
# Get the modebits from a file or directory, ignoring the setgid bit (g+s).
371+
# This bit is inherited by subdirectories at their creation. So we remove it
372+
# from the returning string to prevent callers from having to worry about the
373+
# state of the bit in the test directory.
374+
#
371375
test_modebits () {
372-
ls -ld "$1" | sed -e 's|^\(..........\).*|\1|'
376+
ls -ld "$1" | sed -e 's|^\(..........\).*|\1|' \
377+
-e 's|^\(......\)S|\1-|' -e 's|^\(......\)s|\1x|'
373378
}
374379

375380
# Unset a configuration variable, but don't fail if it doesn't exist.

0 commit comments

Comments
 (0)