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
25 test_expect_success "shared=1 does not clear bits preset by umask $u" '
29 git init --shared=1 &&
30 test 1 = "$(git config core.sharedrepository)"
32 actual=$(ls -l sub/.git/HEAD)
38 echo Oops, .git/HEAD is not 0664 but $actual
46 test_expect_success 'shared=all' '
49 git init --shared=all &&
50 test 2 = $(git config core.sharedrepository)
53 test_expect_success 'update-server-info honors core.sharedRepository' '
59 git update-server-info &&
60 actual="$(ls -l .git/info/refs)" &&
66 echo Oops, .git/info/refs is not 0444
72 for u in 0660:rw-rw---- \
78 x=$(expr "$u" : ".*:\([rw-]*\)") &&
79 y=$(echo "$x" | sed -e "s/w/-/g") &&
80 u=$(expr "$u" : "\([0-7]*\)") &&
81 git config core.sharedrepository "$u" &&
84 test_expect_success "shared = $u ($y) ro" '
86 rm -f .git/info/refs &&
87 git update-server-info &&
88 actual="$(ls -l .git/info/refs)" &&
89 actual=${actual%% *} &&
90 test "x$actual" = "x-$y" || {
97 test_expect_success "shared = $u ($x) rw" '
99 rm -f .git/info/refs &&
100 git update-server-info &&
101 actual="$(ls -l .git/info/refs)" &&
102 actual=${actual%% *} &&
103 test "x$actual" = "x-$x" || {
112 test_expect_success 'git reflog expire honors core.sharedRepository' '
113 git config core.sharedRepository group &&
114 git reflog expire --all &&
115 actual="$(ls -l .git/logs/refs/heads/master)" &&
121 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]