gitolite/src/commands/info

44 lines
932 B
Plaintext
Raw Normal View History

#!/usr/bin/perl
use strict;
use warnings;
use lib $ENV{GL_BINDIR};
use Gitolite::Rc;
use Gitolite::Common;
use Gitolite::Conf::Load;
=for usage
Usage: gitolite info
- list all repos/repo groups you can access
- no options, no flags
=cut
usage() if @ARGV;
my $user = $ENV{GL_USER} or _die "GL_USER not set";
my $ref = 'any';
2012-03-15 15:34:30 +01:00
print "hello $user, this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
2012-03-15 01:37:41 +01:00
my $lr = lister_dispatch('list-repos');
my $lm = lister_dispatch('list-members');
2012-03-15 01:37:41 +01:00
for ( @{ $lr->() } ) {
my $perm = '';
for my $aa (qw(R W ^C)) {
2012-03-15 15:34:30 +01:00
my $ret = access( $_, $user, $aa, $ref );
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
}
2012-03-15 01:37:41 +01:00
next unless $perm =~ /\S/;
if (/^\@/) {
print "\n$perm\t$_\n";
for ( @{ $lm->($_) } ) {
print "$perm\t$_\n";
}
print "\n";
} else {
print "$perm\t$_\n";
}
}