repo-specific hooks: fix bug in handling reserved hooks
[gitolite.git] / t / wild-2.t
blobcbba4f8726ed4a35b1e39819f9069d3ed2d13e8f
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 # this is hardcoded; change it if needed
6 use lib "src/lib";
7 use Gitolite::Test;
9 # wild repos - part 2
10 # ----------------------------------------------------------------------
12 try "plan 65";
14 confreset;confadd '
15 @prof = u1
16 @TAs = u2 u3
17 @students = u4 u5 u6
19 @gfoo = foo/CREATOR/a[0-9][0-9]
20 repo @gfoo
21 C = @students
22 RW+ = CREATOR
23 RW = WRITERS @TAs
24 R = READERS @prof
27 try "ADMIN_PUSH set1; !/FATAL/" or die text();
29 try "
30 cd ..
32 # u1 create fail
33 glt clone u1 file:///foo/u1/a01; !ok; /R any foo/u1/a01 u1 DENIED by fallthru/
35 # u2 create fail
36 glt clone u2 file:///foo/u2/a02; !ok; /R any foo/u2/a02 u2 DENIED by fallthru/
38 # u4 tries to create u2 repo
39 glt clone u4 file:///foo/u2/a12; !ok; /R any foo/u2/a12 u4 DENIED by fallthru/
41 # line anchored regexes
42 glt clone u4 file:///foo/u4/a1234; !ok; /R any foo/u4/a1234 u4 DENIED by fallthru/
44 # u4 tries to create his own repo
45 glt clone u4 file:///foo/u4/a12; ok; /Initialized empty Git repository in .*/foo/u4/a12.git//
46 /warning: You appear to have cloned an empty repository./
48 # u4 push success
49 cd a12
50 tc n-770 n-771 n-772 n-773; ok
51 glt push u4 origin master; ok; /To file:///foo/u4/a12/
52 /\\* \\[new branch\\] master -> master/
54 # u1 clone success
55 cd ..
56 glt clone u1 file:///foo/u4/a12 u1a12; ok; /Cloning into 'u1a12'.../
58 # u1 push fail
59 cd u1a12
60 tc c-442 c-443; ok
61 glt push u1; !ok; /W any foo/u4/a12 u1 DENIED by fallthru/
63 # u2 clone success
64 cd ..
65 glt clone u2 file:///foo/u4/a12 u2a12; ok; /Cloning into 'u2a12'.../
67 # u2 push success
68 cd u2a12
69 tc e-393 e-394; ok;
70 glt push u2; ok; /To file:///foo/u4/a12/
71 /master -> master/
73 # u2 rewind fail
74 glt push u2 -f origin master^:master; !ok; /\\+ refs/heads/master foo/u4/a12 u2 DENIED by fallthru/
75 reject
77 # u4 pull to sync up
78 cd ../a12
79 glt pull u4; ok; /Fast-forward/
80 /From file:///foo/u4/a12/
81 /master -> origin/master/
83 # u4 rewind success
84 git reset --hard HEAD^; ok
85 glt push u4 -f; ok; /To file:///foo/u4/a12/
86 /\\+ .* master -> master \\(forced update\\)/
88 # u5 clone fail
89 cd ..
90 glt clone u5 file:///foo/u4/a12 u5a12; !ok; /R any foo/u4/a12 u5 DENIED by fallthru/
92 # setperm
93 glt perms u4 foo/u4/a12 + READERS u5
94 glt perms u4 foo/u4/a12 + WRITERS u6
96 # getperms
97 glt perms u4 foo/u4/a12 -l
100 cmp 'READERS u5
101 WRITERS u6
104 try "
105 # u5 clone success
106 glt clone u5 file:///foo/u4/a12 u5a12; ok; /Cloning into 'u5a12'.../
108 # u5 push fail
109 cd u5a12
110 tc g-809 g-810; ok
111 glt push u5; !ok; /W any foo/u4/a12 u5 DENIED by fallthru/
113 # u6 clone success
114 cd ..
115 glt clone u6 file:///foo/u4/a12 u6a12; ok; /Cloning into 'u6a12'.../
117 # u6 push success
118 cd u6a12
119 tc f-912 f-913
120 glt push u6 file:///foo/u4/a12; ok; /To file:///foo/u4/a12/
121 /master -> master/
123 # u6 rewind fail
124 glt push u6 -f file:///foo/u4/a12 master^:master
125 !ok; /\\+ refs/heads/master foo/u4/a12 u6 DENIED by fallthru/
126 reject