Make main_cmds and other_cmds local to builtin-help.c
[git/ydirson.git] / t / t1301-shared-repo.sh
blobdc85e8b60a5c10e57047d1692e383f177e2c478d
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 for u in 002 022
22 test_expect_success "shared=1 does not clear bits preset by umask $u" '
23 mkdir sub && (
24 cd sub &&
25 umask $u &&
26 git init --shared=1 &&
27 test 1 = "$(git config core.sharedrepository)"
28 ) &&
29 actual=$(ls -l sub/.git/HEAD)
30 case "$actual" in
31 -rw-rw-r--*)
32 : happy
35 echo Oops, .git/HEAD is not 0664 but $actual
36 false
38 esac
40 rm -rf sub
41 done
43 test_expect_success 'shared=all' '
44 mkdir sub &&
45 cd sub &&
46 git init --shared=all &&
47 test 2 = $(git config core.sharedrepository)
50 test_expect_success 'update-server-info honors core.sharedRepository' '
51 : > a1 &&
52 git add a1 &&
53 test_tick &&
54 git commit -m a1 &&
55 umask 0277 &&
56 git update-server-info &&
57 actual="$(ls -l .git/info/refs)" &&
58 case "$actual" in
59 -r--r--r--*)
60 : happy
63 echo Oops, .git/info/refs is not 0444
64 false
66 esac
69 for u in 0660:rw-rw---- \
70 0640:rw-r----- \
71 0600:rw------- \
72 0666:rw-rw-rw- \
73 0664:rw-rw-r--
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" &&
79 umask 0277 &&
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" || {
88 ls -lt .git/info
89 false
93 umask 077 &&
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" || {
101 ls -lt .git/info
102 false
107 done
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)" &&
113 case "$actual" in
114 -rw-rw-*)
115 : happy
118 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]
119 false
121 esac
124 test_done