3 # Copyright (c) 2007 Johannes Schindelin
6 test_description
='Test shared repository initialization'
10 # User must have read permissions to the repo -> failure on --shared=0400
11 test_expect_success
'shared = 0400 (faulty permission u-w)' '
13 cd sub && git init --shared=0400
22 test_expect_success
"shared=1 does not clear bits preset by umask $u" '
26 git init --shared=1 &&
27 test 1 = "$(git config core.sharedrepository)"
29 actual=$(ls -l sub/.git/HEAD)
35 echo Oops, .git/HEAD is not 0664 but $actual
43 test_expect_success
'shared=all' '
46 git init --shared=all &&
47 test 2 = $(git config core.sharedrepository)
50 test_expect_success
'update-server-info honors core.sharedRepository' '
56 git update-server-info &&
57 actual="$(ls -l .git/info/refs)" &&
63 echo Oops, .git/info/refs is not 0444
69 for u
in 0660:rw-rw---- \
75 x
=$
(expr "$u" : ".*:\([rw-]*\)") &&
76 y
=$
(echo "$x" |
sed -e "s/w/-/g") &&
77 u
=$
(expr "$u" : "\([0-7]*\)") &&
78 git config core.sharedrepository
"$u" &&
81 test_expect_success
"shared = $u ($y) ro" '
83 rm -f .git/info/refs &&
84 git update-server-info &&
85 actual="$(ls -l .git/info/refs)" &&
86 actual=${actual%% *} &&
87 test "x$actual" = "x-$y" || {
94 test_expect_success
"shared = $u ($x) rw" '
96 rm -f .git/info/refs &&
97 git update-server-info &&
98 actual="$(ls -l .git/info/refs)" &&
99 actual=${actual%% *} &&
100 test "x$actual" = "x-$x" || {
109 test_expect_success
'git reflog expire honors core.sharedRepository' '
110 git config core.sharedRepository group &&
111 git reflog expire --all &&
112 actual="$(ls -l .git/logs/refs/heads/master)" &&
118 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]