make standalone config entries work

For example, in

    repo foo/..*
        C   =   u1 u2 u3
        RW+ =   CREATOR
        RW  =   WRITERS
        R   =   READERS

        config hooks.emailprefix = '[%GL_REPO] '
        config foo.bar  = bar one

    repo foo/u1/..*
        config bar.baz  = frob nitz

make that last config also work!
This commit is contained in:
Sitaram Chamarty 2012-03-26 05:40:49 +05:30
parent 5d1adc63c2
commit 96ccbf0c1c
2 changed files with 4 additions and 6 deletions

View file

@ -286,7 +286,7 @@ sub memberships {
$base2 = generic_name($base); $base2 = generic_name($base);
# second, you need to check in %repos also # second, you need to check in %repos also
for my $i ( keys %repos ) { for my $i ( keys %repos, keys %configs ) {
if ( $base eq $i or $base =~ /^$i$/ or $base2 and ( $base2 eq $i or $base2 =~ /^$i$/ ) ) { if ( $base eq $i or $base =~ /^$i$/ or $base2 and ( $base2 eq $i or $base2 =~ /^$i$/ ) ) {
push @ret, $i; push @ret, $i;
} }

View file

@ -18,7 +18,7 @@ sub ok { (+shift) ? print "ok\n" : print "not ok\n"; }
sub nok { (+shift) ? print "not ok\n" : print "ok\n"; } sub nok { (+shift) ? print "not ok\n" : print "ok\n"; }
sub msg { return unless $ENV{D}; print STDERR "#" . +shift . "\n"; } sub msg { return unless $ENV{D}; print STDERR "#" . +shift . "\n"; }
try "plan 88"; try "plan 90";
try " try "
cat $ENV{HOME}/.gitolite.rc cat $ENV{HOME}/.gitolite.rc
@ -49,7 +49,6 @@ confreset;confadd '
@oddguys = u1 u3 u5 @oddguys = u1 u3 u5
@evensout = u2 u4 u6 @evensout = u2 u4 u6
# TODO
repo cc/sub/..* repo cc/sub/..*
config sub.cc = 1 config sub.cc = 1
'; ';
@ -166,8 +165,7 @@ my @a;
@a = config("cc/sub/one", "for.cc"); ok($a[0] eq 'for.cc' and $a[1] eq '1'); @a = config("cc/sub/one", "for.cc"); ok($a[0] eq 'for.cc' and $a[1] eq '1');
@a = config("cc/sub/one", "fo\\..cc"); ok(scalar(@a) == 0); @a = config("cc/sub/one", "fo\\..cc"); ok(scalar(@a) == 0);
# TODO @a = config("cc/sub/one", "su..cc"); ok($a[0] eq 'sub.cc' and $a[1] eq '1');
# @a = config("cc/sub/one", "su..cc"); ok($a[0] eq 'sub.cc' and $a[1] eq '1'); @a = config("cc/sub/one", "sub.cc"); ok($a[0] eq 'sub.cc' and $a[1] eq '1');
# @a = config("cc/sub/one", "sub.cc"); ok($a[0] eq 'sub.cc' and $a[1] eq '1');
@a = config("cc/sub/one", "su\\..cc"); ok(scalar(@a) == 0); @a = config("cc/sub/one", "su\\..cc"); ok(scalar(@a) == 0);