aboutsummaryrefslogtreecommitdiff
blob: d0fe8cfc76e6a9bae79b4c392dafeca88a12a084 (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
91
# vim: syn=sh:
for wr in 0 1
do
    for bc in 0 1
    do
        cd $TESTDIR
        $TESTDIR/rollback || die "rollback failed"
        editrc GL_WILDREPOS $wr
        editrc GL_BIG_CONFIG $bc

        # ----------

        name "fail to set foo.bar"
        echo "
            @leads = u1 u2
            @devs = u1 u2 u3 u4

            @gbar = bar
            repo    @gbar
                RW+             =   @leads
                RW              =   @devs
                config foo.bar  =   baz
        " | ugc
        expect "remote:         git config foo.bar not allowed"
        runremote cat repositories/bar.git/config
        notexpect '^.foo'
        notexpect 'bar = baz'

        name "update rc file to allow foo.*"
        catrc
        cp ~/1 ~/junk
        perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "foo\\\\..*"/' ~/junk
        cat ~/junk | runremote dd of=.gitolite.rc
        catrc
        expect "GL_GITCONFIG_KEYS.*foo"

        name "ok to set foo.bar"
        echo "
            @leads = u1 u2
            @devs = u1 u2 u3 u4

            @gbar = bar
            repo    @gbar
                RW+             =   @leads
                RW              =   @devs
                config foo.bar  =   baz
        " | ugc -r
        expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/bar.git/"
        notexpect "git config.*not allowed"
        expect_push_ok "master -> master"
        runremote cat $TEST_BASE/bar.git/config
        expect '^.foo'
        expect 'bar = baz'

        name "fail to set foobar.baz"
        echo "
            @leads = u1 u2
            @devs = u1 u2 u3 u4

            @gbar = bar
            repo    @gbar
                RW+             =   @leads
                RW              =   @devs
                config foo.bar  =   baz
                config foobar.baz  =   ooka
        " | ugc -r
        expect "remote:         git config foobar.baz not allowed"
        runremote cat $TEST_BASE/bar.git/config
        expect '^.foo'
        expect 'bar = baz'
        notexpect '^.foobar'
        notexpect 'baz = ooka'

        name "delete foo.bar"
        echo "
            @leads = u1 u2
            @devs = u1 u2 u3 u4

            @gbar = bar
            repo    @gbar
                RW+             =   @leads
                RW              =   @devs
                config foo.bar  =   
        " | ugc -r
        runremote cat $TEST_BASE/bar.git/config
        expect '^.foo'
        notexpect 'bar = baz'

        name INTERNAL
    done
done