summaryrefslogtreecommitdiffstats
path: root/t/refex-expr-test-1
blob: 1372a1ea531f1c325f9da514c3914f9e633085f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

# not part of the official test suite (yet); just some q&d testing

# to be run from ~/gitolite as ./$0

set -e
exec 3>&2
exec > /dev/null
exec 2> /dev/null
print2() { echo -n "$@" >&3; }
say2() { echo "$@" >&3; }
die() { echo FATAL: "$@" >&3; exit 1; }

export od=$PWD
export tmp=$(mktemp -d)
echo $tmp >&3
trap "rm -rf $tmp" 0
cd $tmp

print2 setting up...
( cd $od; t/reset )
echo "push @{ \$RC{ENABLE} }, 'refex-expr';" >> ~/.gitolite.rc
cat <<EOF >> ~/.gitolite/conf/gitolite.conf

repo r1
    RW+                                 =   u1 u2   # line 1

    RW+ master                          =   u3 u4   # line 2
    RW+                                 =   u3 u4   # line 3
    RW+ VREF/NAME/Makefile              =   u3 u4   # line 4
    -   master and VREF/NAME/Makefile   =   u3 u4   # line 5

EOF
gitolite setup
say2 done

# ----------------------------------------------------------------------

rm -rf u1
git clone u1:r1 u1
cd u1
tsh 'tc f1'
git push u1:r1 master
tsh 'tc f2'
git push u2:r1 master
tsh 'tc f3'
git push u3:r1 master
tsh 'tc f4'
git push u4:r1 master
say2 everyone master no Makefile

tsh 'tc f5 Makefile'
git push u1:r1 master
tsh 'tc f5 Makefile'
git push u1:r1 master:m1
say2 u1 Makefile master

tsh 'tc f5 Makefile'
git push u3:r1 master && die u3 r1 master should have failed
git push u3:r1 master:m2
say2 u3 Makefile master fail m2 pass