3 # Copyright (c) 2007 Johannes Schindelin
6 test_description
='Test shared repository initialization'
10 # Remove a default ACL from the test dir if possible.
11 setfacl
-k .
2>/dev
/null
13 # User must have read permissions to the repo -> failure on --shared=0400
14 test_expect_success
'shared = 0400 (faulty permission u-w)' '
16 cd sub && git init --shared=0400
24 ls -l "$1" |
sed -e 's|^\(..........\).*|\1|'
29 test_expect_success
"shared=1 does not clear bits preset by umask $u" '
33 git init --shared=1 &&
34 test 1 = "$(git config core.sharedrepository)"
36 actual=$(ls -l sub/.git/HEAD)
42 echo Oops, .git/HEAD is not 0664 but $actual
50 test_expect_success
'shared=all' '
53 git init --shared=all &&
54 test 2 = $(git config core.sharedrepository)
57 say
"update-server-info not supported - skipping tests"
61 test_expect_success
'update-server-info honors core.sharedRepository' '
67 git update-server-info &&
68 actual="$(ls -l .git/info/refs)" &&
74 echo Oops, .git/info/refs is not 0444
80 for u
in 0660:rw-rw---- \
86 x
=$
(expr "$u" : ".*:\([rw-]*\)") &&
87 y
=$
(echo "$x" |
sed -e "s/w/-/g") &&
88 u
=$
(expr "$u" : "\([0-7]*\)") &&
89 git config core.sharedrepository
"$u" &&
92 test_expect_success
"shared = $u ($y) ro" '
94 rm -f .git/info/refs &&
95 git update-server-info &&
96 actual="$(modebits .git/info/refs)" &&
97 test "x$actual" = "x-$y" || {
104 test_expect_success
"shared = $u ($x) rw" '
106 rm -f .git/info/refs &&
107 git update-server-info &&
108 actual="$(modebits .git/info/refs)" &&
109 test "x$actual" = "x-$x" || {
118 test_expect_success
'git reflog expire honors core.sharedRepository' '
119 git config core.sharedRepository group &&
120 git reflog expire --all &&
121 actual="$(ls -l .git/logs/refs/heads/master)" &&
127 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]