Fix "config_error_nonbool" used with value instead of key
[git/mjg.git] / t / t1301-shared-repo.sh
blob6c78c8bc9b76828c258f524e73b40d7daff7c305
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes Schindelin
6 test_description='Test shared repository initialization'
8 . ./test-lib.sh
10 # User must have read permissions to the repo -> failure on --shared=0400
11 test_expect_success 'shared = 0400 (faulty permission u-w)' '
12 mkdir sub && (
13 cd sub && git init --shared=0400
15 ret="$?"
16 rm -rf sub
17 test $ret != "0"
20 test_expect_success 'shared=all' '
21 mkdir sub &&
22 cd sub &&
23 git init --shared=all &&
24 test 2 = $(git config core.sharedrepository)
27 test_expect_success 'update-server-info honors core.sharedRepository' '
28 : > a1 &&
29 git add a1 &&
30 test_tick &&
31 git commit -m a1 &&
32 umask 0277 &&
33 git update-server-info &&
34 actual="$(ls -l .git/info/refs)" &&
35 case "$actual" in
36 -r--r--r--*)
37 : happy
40 echo Oops, .git/info/refs is not 0444
41 false
43 esac
46 for u in 0660:rw-rw---- \
47 0640:rw-r----- \
48 0600:rw------- \
49 0666:rw-rw-rw- \
50 0664:rw-rw-r--
52 x=$(expr "$u" : ".*:\([rw-]*\)") &&
53 y=$(echo "$x" | sed -e "s/w/-/g") &&
54 u=$(expr "$u" : "\([0-7]*\)") &&
55 git config core.sharedrepository "$u" &&
56 umask 0277 &&
58 test_expect_success "shared = $u ($y) ro" '
60 rm -f .git/info/refs &&
61 git update-server-info &&
62 actual="$(ls -l .git/info/refs)" &&
63 actual=${actual%% *} &&
64 test "x$actual" = "x-$y" || {
65 ls -lt .git/info
66 false
70 umask 077 &&
71 test_expect_success "shared = $u ($x) rw" '
73 rm -f .git/info/refs &&
74 git update-server-info &&
75 actual="$(ls -l .git/info/refs)" &&
76 actual=${actual%% *} &&
77 test "x$actual" = "x-$x" || {
78 ls -lt .git/info
79 false
84 done
86 test_expect_success 'git reflog expire honors core.sharedRepository' '
87 git config core.sharedRepository group &&
88 git reflog expire --all &&
89 actual="$(ls -l .git/logs/refs/heads/master)" &&
90 case "$actual" in
91 -rw-rw-*)
92 : happy
95 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]
96 false
98 esac
101 test_done