repo-specific hooks: fix bug in handling reserved hooks
[gitolite.git] / t / vrefs-2.t
blob40db3087b285a05067fe51c505e98774cb8c21a4
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 # VREFs - part 2
10 # ----------------------------------------------------------------------
12 try "plan 72";
14 put "../gitolite-admin/conf/gitolite.conf", "
15 \@gfoo = foo
16 \@lead = u1
17 \@senior_devs = u2 u3
18 \@junior_devs = u4 u5 u6
19 repo \@gfoo
21 RW+ = \@all
23 RW+ VREF/COUNT/2/NO_SIGNOFF = \@lead
24 - VREF/COUNT/2/NO_SIGNOFF = \@all
26 - VREF/COUNT/10/NEWFILES = \@junior_devs
28 - VREF/FILETYPE/AUTOGENERATED = \@all
31 try "
32 ADMIN_PUSH vr2a
33 cd ..
34 # setup
35 [ -d foo ]; !ok
36 CLONE u1 foo; ok; /Cloning into/
37 /You appear to have cloned an empty/
38 cd foo; ok
39 [ -d .git ]; ok
41 # u1 push 15 new files
42 tc a b c d e f g h i j k l m n o
43 ok; /d8c0392/
44 PUSH u1 master; ok; /new branch.*master -. master/
46 # u2 push 2 new 10 old without signoff
47 tc a b c d e f g h i j u2a u2b
48 ok; /6787ac9/
49 PUSH u2; ok; /d8c0392..6787ac9.*master -. master/
51 # u2 fail to push 3 new files without signoff
52 tc u2c u2d u2e; ok; /a74562b/
53 PUSH u2; !ok; /W VREF/COUNT/2/NO_SIGNOFF foo u2 DENIED by VREF/COUNT/2/NO_SIGNOFF/
54 /top commit message should include the text .3 new files signed-off by: tester.example.com./
55 /hook declined/
56 /remote rejected/
57 # u2 push 15 new files with signoff
58 tc u2f u2g u2h u2i u2j u2k u2l u2m u2n u2o u2p u2q
59 ok; /8dd31aa/
60 git commit --allow-empty -m '15 new files signed-off by: tester\@example.com'
61 ok; /.master 6126489. 15 new files signed-off by: tester.example.com/
62 PUSH u2; ok; /6787ac9..6126489.*master -. master/
64 # u4 push 2 new 10 old files without signoff
65 tc u4a u4b a b c d e f g h i j
66 ok; /76c5593/
67 PUSH u4; ok; /6126489..76c5593.*master -. master/
69 # u4 fail push 3 new files withoug signoff
70 tc u4c u4d u4e; ok; /2a84398/
71 PUSH u4; !ok; /W VREF/COUNT/2/NO_SIGNOFF foo u4 DENIED by VREF/COUNT/2/NO_SIGNOFF/
72 /top commit message should include the text .3 new files signed-off by: tester.example.com./
73 /hook declined/
74 /remote rejected/
76 # u4 push 10 new 5 old with signoff
77 tc u4f u4g u4h u4i u4j u4k u4l a b c d e
78 ok; /09b646a/
79 git commit --allow-empty -m '10 new files signed-off by: tester\@example.com'
80 ok; /.master 47f84b0. 10 new files signed-off by: tester.example.com/
81 PUSH u4; ok; /76c5593..47f84b0.*master -. master/
83 # u4 fail push 11 new files even with signoff
84 tc u4ab u4ac u4ad u4ae u4af u4ag u4ah u4ai u4aj u4ak u4al
85 ok; /90e7344/
86 git commit --allow-empty -m '11 new files signed-off by: tester\@example.com'
87 ok; /.master 1f36537. 11 new files signed-off by: tester.example.com/
88 PUSH u4; !ok; /W VREF/COUNT/10/NEWFILES foo u4 DENIED by VREF/COUNT/10/NEWFILES/
89 /too many new files in this push/
90 /hook declined/
91 /remote rejected/
93 # test AUTOGENERATED vref
94 glt fetch u1 origin; ok;
95 reset-h origin/master; ok;
96 tc not-really.java; ok; /0f88b2e/
97 PUSH u4; ok; /47f84b0..0f88b2e.*master -. master/
100 put "|cat >> not-really.java", "
101 Generated by the protocol buffer compiler. DO NOT EDIT
104 try "
105 commit -am pbc; ok; /b2df6ef/
106 PUSH u4; !ok; /W VREF/FILETYPE/AUTOGENERATED foo u4 DENIED by VREF/FILETYPE/AUTOGENERATED/
107 /hook declined/
108 /remote rejected/