5 # this is hardcoded; change it if needed
9 # permissions using role names
10 # ----------------------------------------------------------------------
13 try
"DEF POK = !/DENIED/; !/failed to push/";
23 - refs/tags/ = WRITERS
27 RW refs/tags/ = TESTERS
30 try
"ADMIN_PUSH set1; !/FATAL/" or die text
();
38 glt clone u1 file:///foo/u1/u1r1
39 /Initialized empty Git repository in .*/foo/u1/u1r1.git//
44 glt push u1 file:///foo/u1/u1r1 master:master
45 POK; /master -> master/
46 # CREATOR can create branch
48 glt push u1 file:///foo/u1/u1r1 master:b1
50 # CREATOR can rewind branch
51 git reset --hard HEAD^
53 glt push u1 file:///foo/u1/u1r1 +master:b1
54 POK; /master -> b1 \\(forced update\\)/
55 # CREATOR cannot delete branch
56 glt push u1 file:///foo/u1/u1r1 :b1
57 /D refs/heads/b1 foo/u1/u1r1 u1 DENIED by fallthru/
60 # CREATOR can push a tag
62 glt push u1 file:///foo/u1/u1r1 t1
63 POK; /\\[new tag\\] t1 -> t1/
66 echo WRITERS \@g2 | glt perms u1 -c foo/u1/u1r1
67 glt perms u1 foo/u1/u1r1 -l
71 git reset --hard origin/master
75 glt push u2 file:///foo/u1/u1r1 master:master
76 POK; /master -> master/
77 # WRITERS can create branch
79 glt push u2 file:///foo/u1/u1r1 master:b2
81 # WRITERS cannot rewind branch
82 git reset --hard HEAD^
84 glt push u2 file:///foo/u1/u1r1 +master:b2
85 /\\+ refs/heads/b2 foo/u1/u1r1 u2 DENIED by fallthru/
87 # WRITERS cannot delete branch
88 glt push u2 file:///foo/u1/u1r1 :b2
89 /D refs/heads/b2 foo/u1/u1r1 u2 DENIED by fallthru/
91 # WRITERS cannot push a tag
93 glt push u2 file:///foo/u1/u1r1 t2
94 /W refs/tags/t2 foo/u1/u1r1 u2 DENIED by refs/tags//
97 # change u2 to READERS
98 echo READERS u2 | glt perms u1 -c foo/u1/u1r1
99 glt perms u1 foo/u1/u1r1 -l
103 git reset --hard origin/master
105 # READERS cannot push at all
107 glt push u2 file:///foo/u1/u1r1 master:master
108 /W any foo/u1/u1r1 u2 DENIED by fallthru/
110 # add invalid category MANAGERS
111 /usr/bin/printf 'READERS u6\\nMANAGERS u2\\n' | glt perms u1 -c foo/u1/u1r1
113 /Invalid role 'MANAGERS'/
116 # make MANAGERS valid
117 put
"$ENV{HOME}/g3trc", "\$rc{ROLES}{MANAGERS} = 1;\n";
119 # add u2 to now valid MANAGERS
121 ENV G3T_RC=$ENV{HOME}/g3trc
122 gitolite compile; ok or die compile failed
123 /usr/bin/printf 'READERS u6\\nMANAGERS u2\\n' | glt perms u1 -c foo/u1/u1r1
124 ok; !/Invalid role 'MANAGERS'/
125 glt perms u1 foo/u1/u1r1 -l
134 git reset --hard origin/master
138 glt push u2 file:///foo/u1/u1r1 master:master
139 POK; /master -> master/
141 # MANAGERS can create branch
143 glt push u2 file:///foo/u1/u1r1 master:b3
145 # MANAGERS can rewind branch
146 git reset --hard HEAD^
148 glt push u2 file:///foo/u1/u1r1 +master:b3
149 POK; /master -> b3 \\(forced update\\)/
150 # MANAGERS cannot delete branch
151 glt push u2 file:///foo/u1/u1r1 :b3
152 / - \\[deleted\\] b3/
153 # MANAGERS can push a tag
155 glt push u2 file:///foo/u1/u1r1 t3
156 POK; /\\[new tag\\] t3 -> t3/
158 # add invalid category TESTERS
159 echo TESTERS u2 | glt perms u1 -c foo/u1/u1r1
161 /Invalid role 'TESTERS'/
165 put
"|cat >> $ENV{HOME}/g3trc", "\$rc{ROLES}{TESTERS} = 1;\n";
168 gitolite compile; ok or die compile failed
169 # add u2 to now valid TESTERS
170 echo TESTERS u2 | glt perms u1 -c foo/u1/u1r1
171 !/Invalid role 'TESTERS'/
172 glt perms u1 foo/u1/u1r1 -l
180 git reset --hard origin/master
182 # TESTERS cannot push
184 glt push u2 file:///foo/u1/u1r1 master:master
185 /W refs/heads/master foo/u1/u1r1 u2 DENIED by fallthru/
187 # TESTERS cannot create branch
189 glt push u2 file:///foo/u1/u1r1 master:b4
190 /W refs/heads/b4 foo/u1/u1r1 u2 DENIED by fallthru/
192 # TESTERS cannot delete branch
193 glt push u2 file:///foo/u1/u1r1 :b2
194 /D refs/heads/b2 foo/u1/u1r1 u2 DENIED by fallthru/
196 # TESTERS can push a tag
198 glt push u2 file:///foo/u1/u1r1 t4
199 POK; /\\[new tag\\] t4 -> t4/
202 # make TESTERS invalid again
203 put
"$ENV{HOME}/g3trc", "\$rc{ROLES}{MANAGERS} = 1;\n";
206 gitolite compile; ok or die compile failed
209 git reset --hard origin/master
211 glt push u1 file:///foo/u1/u1r1 master:master
212 POK; /master -> master/
213 # TESTERS is an invalid category
215 glt push u2 file:///foo/u1/u1r1 t5
216 /role 'TESTERS' not allowed, ignoring/
217 /W any foo/u1/u1r1 u2 DENIED by fallthru/