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
maint
Junio C Hamano 2021-02-05 16:31:22 -08:00
commit 801e896683
1 changed files with 7 additions and 2 deletions

View File

@ -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.