completion: add more 'git add' options
[git/gitweb.git] / t / t1301-shared-repo.sh
blob5e4252a320d5f967eacb9bd68bb0a510fe748e80
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_done