3 # Copyright (c) 2010 Matthieu Moy
6 test_description
='Test repository with default ACL'
8 # Create the test repo with restrictive umask
9 # => this must come before . ./test-lib.sh
14 # We need an arbitrary other user give permission to using ACLs. root
15 # is a good candidate: exists on all unices, and it has permission
16 # anyway, so we don't create a security hole running the testsuite.
18 if ! setfacl
-m u
:root
:rwx .
; then
19 say
"Skipping ACL tests: unable to use setfacl"
24 ls -l "$1" |
sed -e 's|^\(..........\).*|\1|'
27 check_perms_and_acl
() {
28 actual
=$
(modebits
"$1") &&
34 echo "Got permission '$actual', expected '-r--r-----'"
38 getfacl
"$1" > actual
&&
39 grep -q "user:root:rwx" actual
&&
40 grep -q "user:${LOGNAME}:rwx" actual
&&
41 grep -q "mask::r--" actual
&&
42 grep -q "group::---" actual || false
45 dirs_to_set
="./ .git/ .git/objects/ .git/objects/pack/"
47 test_expect_success
'Setup test repo' '
48 setfacl -m u:root:rwx $dirs_to_set &&
49 setfacl -d -m u:"$LOGNAME":rwx $dirs_to_set &&
50 setfacl -d -m u:root:rwx $dirs_to_set &&
57 test_expect_success
'Objects creation does not break ACLs with restrictive umask' '
59 check_perms_and_acl .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
62 test_expect_success
'git gc does not break ACLs with restrictive umask' '
64 check_perms_and_acl .git/objects/pack/*.pack