(!!) personal branches -- 1 line of code, 50 lines of test!
(and by the way even in g2 this was not so easy as just ONE line of code!)
This commit is contained in:
parent
876f6517f5
commit
9780ddab9d
|
@ -68,7 +68,7 @@ sub access {
|
|||
trace( 3, scalar(@rules) . " rules found" );
|
||||
for my $r (@rules) {
|
||||
my $perm = $r->[1];
|
||||
my $refex = $r->[2];
|
||||
my $refex = $r->[2]; $refex =~ s(/USER/)(/$user/);
|
||||
trace( 4, "perm=$perm, refex=$refex" );
|
||||
|
||||
# skip 'deny' rules if the ref is not (yet) known
|
||||
|
|
51
t/personal-branches.t
Executable file
51
t/personal-branches.t
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# this is hardcoded; change it if needed
|
||||
use lib "src";
|
||||
use Gitolite::Test;
|
||||
|
||||
# basic tests
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
try "plan 39";
|
||||
|
||||
confreset;confadd '
|
||||
@admins = admin dev1
|
||||
repo gitolite-admin
|
||||
RW+ = admin
|
||||
|
||||
repo testing
|
||||
RW+ = @all
|
||||
|
||||
@g1 = t1
|
||||
repo @g1
|
||||
R = u2
|
||||
RW = u3
|
||||
RW+ = u4
|
||||
RW a/USER/ = @all
|
||||
RW+ p/USER/ = u1 u6
|
||||
';
|
||||
|
||||
try "ADMIN_PUSH set1; !/FATAL/" or die text();
|
||||
|
||||
try "
|
||||
|
||||
gitolite access t1 u1; ok; /refs/heads/p/u1//; !/DENIED/
|
||||
gitolite access t1 u5; !ok; /\\+ any t1 u5 DENIED by fallthru/
|
||||
gitolite access \@g1 u5 W; ok; /refs/heads/a/u5//; !/DENIED/
|
||||
|
||||
gitolite access t1 u1 W refs/heads/a/user1/foo; !ok; /W refs/heads/a/user1/foo t1 u1 DENIED by fallthru/
|
||||
gitolite access \@g1 u1 + refs/heads/a/user1/foo; !ok; /\\+ refs/heads/a/user1/foo \@g1 u1 DENIED by fallthru/
|
||||
gitolite access t1 u1 W refs/heads/p/user1/foo; !ok; /W refs/heads/p/user1/foo t1 u1 DENIED by fallthru/
|
||||
gitolite access \@g1 u1 + refs/heads/p/user1/foo; !ok; /\\+ refs/heads/p/user1/foo \@g1 u1 DENIED by fallthru/
|
||||
|
||||
gitolite access \@g1 u1 W refs/heads/a/u1/foo; ok; /refs/heads/a/u1//; !/DENIED/
|
||||
gitolite access t1 u1 + refs/heads/a/u1/foo; !ok; /\\+ refs/heads/a/u1/foo t1 u1 DENIED by fallthru/
|
||||
gitolite access \@g1 u1 W refs/heads/p/u1/foo; ok; /refs/heads/p/u1//; !/DENIED/
|
||||
gitolite access t1 u1 + refs/heads/p/u1/foo; ok; /refs/heads/p/u1//; !/DENIED/
|
||||
|
||||
gitolite access \@g1 u1 W refs/heads/p/u2/foo; !ok; /W refs/heads/p/u2/foo \@g1 u1 DENIED by fallthru/
|
||||
gitolite access t1 u1 + refs/heads/p/u2/foo; !ok; /\\+ refs/heads/p/u2/foo t1 u1 DENIED by fallthru/
|
||||
";
|
Loading…
Reference in a new issue