summaryrefslogtreecommitdiffstats
path: root/t/smart-http
blob: 3ac910bcb7a3f5b28b83dcb95aa61bc5c346a608 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash

die() { echo "$@"; exit 1; }

# git clone `url u1 r1`
url() {
    echo http://$1:$1@localhost/git/$2.git
}

# `cmd sitaram info`
cmd() {
    c="curl http://$1:$1@localhost/git"
    shift
    c="$c/$1"
    shift

    if [ -n "$1" ]
    then
        c="$c?$1"
        shift
    fi
    while [ -n "$1" ]
    do
        c="$c+$1"
        shift
    done

    echo $c
}

export tmp=$(mktemp -d);
trap "rm -rf $tmp" 0;
cd $tmp

tsh "plan 28"

tsh "
    ## ls-remote admin admin
    git ls-remote `url admin gitolite-admin`
        ok
        /HEAD/
        /refs.heads.master/
    ## clone
    git clone `url admin gitolite-admin`
        ok
        /Cloning into/
    ls -al gitolite-admin/conf
        /gitolite.conf/
" || die "step 1"

cd gitolite-admin
echo repo t2 >> conf/gitolite.conf
echo 'RW+  = u1 u2' >> conf/gitolite.conf

tsh "
    ## add, commit, push
    git add conf/gitolite.conf
        ok
        !/./
    git commit -m t2
        ok
        /1 file.*changed/
    git push
        ok
        /Initialized.*gitolite-home.repositories.t2.git/
        /To http:..localhost.git.gitolite-admin.git/
        /master -. master/
    ## various ls-remotes
    git ls-remote `url u1 gitolite-admin`
        !ok
        /FATAL: R any gitolite-admin u1 DENIED by fallthru/
    git ls-remote `url u1 t2`
        ok
        !/./
    git ls-remote `url u2 t2`
        ok
        !/./
    git ls-remote `url u3 t2`
        !ok
        /FATAL: R any t2 u3 DENIED by fallthru/
    ## push to u1:t2
    git push      `url u1 t2` master:master
        ok
        /To http:..localhost.git.t2.git/
        /master -. master/
    git ls-remote `url u2 t2`
        ok
        /HEAD/
        /refs.heads.master/
" || die "step 2"