7
use lib $ENV{GL_LIBDIR};
10
use Gitolite::Conf::Load;
13
Usage: gitolite info [-lc] [-ld] [<repo name pattern>]
15
List all existing repos you can access, as well as repo name patterns you can
16
create repos from (if any).
18
'-lc' lists creators as an additional field at the end.
19
'-ld' lists description as an additional field at the end.
21
The optional pattern is an unanchored regex that will limit the repos
22
searched, in both cases. It might speed up things a little if you have more
23
than a few thousand repos.
26
# these two are globals
27
my ( $lc, $ld, $patt ) = args();
31
print_patterns(); # repos he can create for himself
32
print_phy_repos(); # repos already created
33
print "\n$rc{SITE_INFO}\n" if $rc{SITE_INFO};
35
# ----------------------------------------------------------------------
38
my ( $lc, $ld, $patt ) = ( '', '', '' );
47
usage() if @ARGV > 1 or $help;
48
$patt = shift @ARGV || '.';
50
return ( $lc, $ld, $patt );
54
chomp( my $hn = `hostname -s 2>/dev/null || hostname` );
55
my $gv = substr( `git --version`, 12 );
56
$ENV{GL_USER} or _die "GL_USER not set";
57
print "hello $ENV{GL_USER}, this is " . ($ENV{USER} || "httpd") . "\@$hn running gitolite3 " . version() . " on git $gv\n";
63
my $lm = \&Gitolite::Conf::Load::list_members;
65
# find repo patterns only, call them with ^C flag included
66
@$repos = grep { !/$REPONAME_PATT/ } map { /^@/ ? @{ $lm->($_) } : $_ } @{ lister_dispatch('list-repos')->() };
68
listem( $repos, '', '', @aa );
69
# but squelch the 'lc' and 'ld' flags for these
75
# now get the actual repos and get R or W only
76
_chdir( $rc{GL_REPO_BASE} );
77
$repos = list_phy_repos(1);
79
listem( $repos, $lc, $ld, @aa );
83
my ( $repos, $lc, $ld, @aa ) = @_;
85
for my $repo (@$repos) {
86
next unless $repo =~ /$patt/;
88
$creator = creator($repo) if $lc;
91
for my $d ("$ENV{GL_REPO_BASE}/$repo.git/description") {
92
next unless $ld and -r $d;
98
my $ret = access( $repo, $ENV{GL_USER}, $aa, 'any' );
99
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
102
next unless $perm =~ /\S/;
103
print "$perm\t$repo";
104
print "\t$creator" if $lc;
105
print "\t$desc" if $ld;