summaryrefslogtreecommitdiffstats
path: root/t/sequence.t
blob: 8d66d03c25c5152f8ab4c527fb3d42495744a399 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/perl
use strict;
use warnings;

# this is hardcoded; change it if needed
use lib "src/lib";
use Gitolite::Test;

# uhh, seems to be another rule sequence test
# ----------------------------------------------------------------------

try "plan 48";

confreset;confadd '
    @staff = u1 u2 u3
    @gfoo = foo/CREATOR/..*
    repo  @gfoo
          C       = u1
          RW+     = CREATOR
          RW      = WRITERS
          -       = @staff
';

try "ADMIN_PUSH set1; !/FATAL/" or die text();

try "
    cd ..
    glt clone u1 file:///foo/u1/bar;    ok
        /Initialized empty Git repository in .*/foo/u1/bar.git//

    cd bar
    tc p-906
    glt push u1 origin master
        /To file:///foo/u1/bar/
        /\\[new branch\\]      master -> master/
    echo WRITERS u2 | glt perms u1 -c foo/u1/bar
    glt perms u1 foo/u1/bar -l
        /WRITERS u2/
    # expand
    glt info u2
        /R W *\tfoo/u1/bar/
        /R W *\ttesting/

    # push
    cd ..
    glt clone u2 file:///foo/u1/bar u2bar
        /Cloning into 'u2bar'.../
    cd u2bar
    tc p-222
    glt push u2
        /master -> master/
        !/DENIED/
        !/failed to push/
";

confreset;confadd '
    @staff = u1 u2 u3
    @gfoo = foo/CREATOR/..*
    repo  @gfoo
          C       = u1
          RW+     = CREATOR
          -       = @staff
          RW      = WRITERS
          R       = READERS
';

try "ADMIN_PUSH set1; !/FATAL/" or die text();

try "
    cd ..
    rm -rf bar u2bar
    glt clone u1 file:///foo/u1/bar;    ok
        /Initialized empty Git repository in .*/foo/u1/bar.git//

    cd bar
    tc p-906
    glt push u1 origin master
        /To file:///foo/u1/bar/
        /\\[new branch\\]      master -> master/
    echo WRITERS u2 | glt perms u1 -c foo/u1/bar
    glt perms u1 foo/u1/bar -l
        /WRITERS u2/
    # expand
    glt info u2
        !/R W *\tfoo/u1/baz/
        /R W *\tfoo/u1/bar/
        /R W *\ttesting/

    # push
    cd ..
    glt clone u2 file:///foo/u1/bar u2bar
        /Cloning into 'u2bar'.../
    cd u2bar
    tc p-222
    glt push u2
        !ok
        reject
        /W refs/heads/master foo/u1/bar u2 DENIED by refs/\\.\\*/

    # auto-create using perms fail
    echo READERS u5 | glt perms u4 -c foo/u4/baz
        !/Initialized empty Git repository in .*/foo/u4/baz.git/
        /FATAL: repo does not exist, or you are not authorised/

    # auto-create using perms
    echo READERS u2 | glt perms u1 -c foo/u1/baz
        /Initialized empty Git repository in .*/foo/u1/baz.git/

    glt perms u1 foo/u1/baz -l
        /READERS u2/
    # expand
    glt info u2
        /R   *\tfoo/u1/baz/
        /R W *\tfoo/u1/bar/
        /R W *\ttesting/
";