info command deals with groups

This commit is contained in:
Sitaram Chamarty 2012-03-15 06:07:41 +05:30
parent 5ebb981efa
commit 6624d35cf9
3 changed files with 39 additions and 19 deletions

View file

@ -119,6 +119,7 @@ sub load_common {
sub load_1 {
my $repo = shift;
return if $repo =~ /^\@/;
trace( 4, $repo );
_chdir("$rc{GL_REPO_BASE}/$repo.git");

View file

@ -19,13 +19,23 @@ usage() if @ARGV;
my $user = $ENV{GL_USER} or _die "GL_USER not set";
my $ref = 'any';
my $fn = lister_dispatch('list-repos');
my $lr = lister_dispatch('list-repos');
my $lm = lister_dispatch('list-members');
for ( @{ $fn->() } ) {
for ( @{ $lr->() } ) {
my $perm = '';
for my $aa (qw(R W ^C)) {
my $ret = access($_, $user, $aa, $ref);
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
}
print "$perm\t$_\n" if $perm =~ /\S/;
next unless $perm =~ /\S/;
if (/^\@/) {
print "\n$perm\t$_\n";
for ( @{ $lm->($_) } ) {
print "$perm\t$_\n";
}
print "\n";
} else {
print "$perm\t$_\n";
}
}

View file

@ -6,12 +6,13 @@ use warnings;
use lib "src";
use Gitolite::Test;
try 'plan 35';
try 'plan 45';
try "## info";
confreset;confadd '
repo t1
@t1 = t1
repo @t1
RW = u1
R = u2
repo t2
@ -30,23 +31,31 @@ try "
";
try "
glt info u1; ok; gsh
/R W *\tt1/
/R *\tt2/
/R W \t\@t1/
/R W \tt1/
/R \tt2/
!/t3/
/ R W *\ttesting/
/R W \ttesting/
glt info u2; ok; gsh
/R *\tt1/
/R W *\tt2/
/R \t\@t1/
/R \tt1/
/R W \tt2/
!/t3/
/ R W *\ttesting/
/R W \ttesting/
glt info u3; ok; gsh
/R W *\tt3/
!/t1/
!/t2/
/ R W *\ttesting/
/R W \tt3/
!/\@t1/
!/t[12]/
/R W \ttesting/
glt info u4; ok; gsh
/R *\tt3/
!/t1/
!/t2/
/ R W *\ttesting/
/R \tt3/
!/\@t1/
!/t[12]/
/R W \ttesting/
glt info u5; ok; gsh
!/t[123]/
/R W \ttesting/
glt info u6; ok; gsh
!/t[123]/
/R W \ttesting/
" or die;