fix 'C' and 'M' tests in 'gitolite access'...
[gitolite.git] / t / smart-http
blob9ae6d5ba02bb6be04bcfa5b8d5a0be62b11dc587
1 #!/bin/bash
3 die() { echo "$@"; exit 1; }
5 # git clone `url u1 r1`
6 url() {
7 echo http://$1:$1@localhost/git/$2.git
10 # `cmd sitaram info`
11 cmd() {
12 c="curl http://$1:$1@localhost/git"
13 shift
14 c="$c/$1"
15 shift
17 if [ -n "$1" ]
18 then
19 c="$c?$1"
20 shift
22 while [ -n "$1" ]
24 c="$c+$1"
25 shift
26 done
28 echo $c
31 export tmp=$(mktemp -d);
32 trap "rm -rf $tmp" 0;
33 cd $tmp
35 tsh "plan 28"
37 tsh "
38 ## ls-remote admin admin
39 git ls-remote `url admin gitolite-admin`
41 /HEAD/
42 /refs.heads.master/
43 ## clone
44 git clone `url admin gitolite-admin`
46 /Cloning into/
47 ls -al gitolite-admin/conf
48 /gitolite.conf/
49 " || die "step 1"
51 cd gitolite-admin
52 echo repo t2 >> conf/gitolite.conf
53 echo 'RW+ = u1 u2' >> conf/gitolite.conf
55 tsh "
56 ## add, commit, push
57 git add conf/gitolite.conf
59 !/./
60 git commit -m t2
62 /1 file.*changed/
63 git push
65 /Initialized.*usr.share.httpd.gitolite-home.repositories.t2.git/
66 /To http:..localhost.git.gitolite-admin.git/
67 /master -. master/
68 ## various ls-remotes
69 git ls-remote `url u1 gitolite-admin`
70 !ok
71 /FATAL: R any gitolite-admin u1 DENIED by fallthru/
72 git ls-remote `url u1 t2`
74 !/./
75 git ls-remote `url u2 t2`
77 !/./
78 git ls-remote `url u3 t2`
79 !ok
80 /FATAL: R any t2 u3 DENIED by fallthru/
81 ## push to u1:t2
82 git push `url u1 t2` master:master
84 /To http:..localhost.git.t2.git/
85 /master -. master/
86 git ls-remote `url u2 t2`
88 /HEAD/
89 /refs.heads.master/
90 " || die "step 2"