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 setfacl_out="$(setfacl -m u:root:rwx . 2>&1)"
21 if test $setfacl_ret != 0
23 say "Unable to use setfacl (output: '$setfacl_out'; return code: '$setfacl_ret')"
25 test_set_prereq SETFACL
28 check_perms_and_acl () {
30 getfacl "$1" > actual &&
31 grep -q "user:root:rwx" actual &&
32 grep -q "user:${LOGNAME}:rwx" actual &&
33 egrep "mask::?r--" actual > /dev/null 2>&1 &&
34 grep -q "group::---" actual || false
37 dirs_to_set="./ .git/ .git/objects/ .git/objects/pack/"
39 test_expect_success SETFACL 'Setup test repo' '
40 setfacl -m d:u::rwx,d:g::---,d:o:---,d:m:rwx $dirs_to_set &&
41 setfacl -m m:rwx $dirs_to_set &&
42 setfacl -m u:root:rwx $dirs_to_set &&
43 setfacl -m d:u:"$LOGNAME":rwx $dirs_to_set &&
44 setfacl -m d:u:root:rwx $dirs_to_set &&
51 test_expect_success SETFACL 'Objects creation does not break ACLs with restrictive umask' '
53 check_perms_and_acl .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
56 test_expect_success SETFACL 'git gc does not break ACLs with restrictive umask' '
58 check_perms_and_acl .git/objects/pack/*.pack