3
# all gitolite CLI tools run as sub-commands of this command
4
# ----------------------------------------------------------------------
7
Usage: gitolite [sub-command] [options]
9
The following built-in subcommands are available; they should all respond to
10
'-h' if you want further details on each:
12
setup 1st run: initial setup; all runs: hook fixups
13
compile compile gitolite.conf
15
query-rc get values of rc variables
17
list-groups list all group names in conf
18
list-users list all users/user groups in conf
19
list-repos list all repos/repo groups in conf
20
list-phy-repos list all repos actually on disk
21
list-memberships list all groups a name is a member of
22
list-members list all members of a group
25
- list-users is disk bound and could take a while on sites with 1000s of repos
26
- list-memberships does not check if the name is known; unknown names come
27
back with 2 answers: the name itself and '@all'
29
In addition, running 'gitolite help' should give you a list of custom commands
30
available. They may or may not respond to '-h', depending on how they were
34
# ----------------------------------------------------------------------
38
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
39
BEGIN { $ENV{GL_LIBDIR} = "$ENV{GL_BINDIR}/lib"; }
40
use lib $ENV{GL_LIBDIR};
47
# ----------------------------------------------------------------------
49
my ( $command, @args ) = @ARGV;
50
gl_log( 'cli', 'gitolite', @ARGV ) if -d $rc{GL_ADMIN_BASE} and $$ == ( $ENV{GL_TID} || 0 );
53
# the first two commands need options via @ARGV, as they have their own
54
# GetOptions calls and older perls don't have 'GetOptionsFromArray'
56
if ( $command eq 'setup' ) {
58
require Gitolite::Setup;
59
Gitolite::Setup->import;
62
} elsif ( $command eq 'query-rc' ) {
64
query_rc(); # doesn't return
66
# the rest don't need @ARGV per se
68
} elsif ( $command eq 'compile' ) {
69
require Gitolite::Conf;
70
Gitolite::Conf->import;
73
} elsif ( $command eq 'trigger' ) {
76
} elsif ( my $c = _which("commands/$command", 'x' ) ) {
77
trace( 2, "attempting gitolite command $c" );
81
} elsif ( $command eq 'list-phy-repos' ) {
82
_chdir( $rc{GL_REPO_BASE} );
83
print "$_\n" for ( @{ list_phy_repos(@args) } );
85
} elsif ( $command =~ /^list-/ ) {
86
trace( 2, "attempting lister command $command" );
87
require Gitolite::Conf::Load;
88
Gitolite::Conf::Load->import;
89
my $fn = lister_dispatch($command);
90
print "$_\n" for ( @{ $fn->(@args) } );
93
_die "unknown gitolite sub-command";
96
gl_log('END') if $$ == $ENV{GL_TID};
99
usage() if not $command or $command eq '-h';
102
# ----------------------------------------------------------------------