Windows ANSI - hook write()
[git/mingw/4msysgit/peterh.git] / t / t1301-shared-repo.sh
blob1e27825209ca61c815fc7e1dbac9714d006b6055
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 say "update-server-info not supported - skipping tests"
28 test_done
29 exit 0
31 test_expect_success 'update-server-info honors core.sharedRepository' '
32 : > a1 &&
33 git add a1 &&
34 test_tick &&
35 git commit -m a1 &&
36 umask 0277 &&
37 git update-server-info &&
38 actual="$(ls -l .git/info/refs)" &&
39 case "$actual" in
40 -r--r--r--*)
41 : happy
44 echo Oops, .git/info/refs is not 0444
45 false
47 esac
50 for u in 0660:rw-rw---- \
51 0640:rw-r----- \
52 0600:rw------- \
53 0666:rw-rw-rw- \
54 0664:rw-rw-r--
56 x=$(expr "$u" : ".*:\([rw-]*\)") &&
57 y=$(echo "$x" | sed -e "s/w/-/g") &&
58 u=$(expr "$u" : "\([0-7]*\)") &&
59 git config core.sharedrepository "$u" &&
60 umask 0277 &&
62 test_expect_success "shared = $u ($y) ro" '
64 rm -f .git/info/refs &&
65 git update-server-info &&
66 actual="$(ls -l .git/info/refs)" &&
67 actual=${actual%% *} &&
68 test "x$actual" = "x-$y" || {
69 ls -lt .git/info
70 false
74 umask 077 &&
75 test_expect_success "shared = $u ($x) rw" '
77 rm -f .git/info/refs &&
78 git update-server-info &&
79 actual="$(ls -l .git/info/refs)" &&
80 actual=${actual%% *} &&
81 test "x$actual" = "x-$x" || {
82 ls -lt .git/info
83 false
88 done
90 test_expect_success 'git reflog expire honors core.sharedRepository' '
91 git config core.sharedRepository group &&
92 git reflog expire --all &&
93 actual="$(ls -l .git/logs/refs/heads/master)" &&
94 case "$actual" in
95 -rw-rw-*)
96 : happy
99 echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]
100 false
102 esac
105 test_done