gitolite/t/glt
Sitaram Chamarty 999f9cd39d make site-local scripts easier to write
- new Gitolite::Easy module hides all the other stuff
  - (put GL_ADMIN_BASE and GL_REPO_BASE into %ENV)
  - new 'gitolite creator' shell command
  - 'writes' command modified to use Gitolite::Easy.  It is also the
    only dual mode command -- it can be invoked remotely as well as
    locally.  I deem that the required trick to make other remote-only
    commands work locally is too much trouble for what is probably a
    rarely used command.
2012-03-24 10:30:45 +05:30

42 lines
1.1 KiB
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
my $cmd = shift or die "need command";
my $user = shift or die "need user";
my $rc;
my %extcmds = (
help => 1,
info => 1,
perms => 1,
writes => 1,
);
$ENV{G3T_USER} = $user;
if ($extcmds{$cmd}) {
$ENV{SSH_ORIGINAL_COMMAND} = join(" ", $cmd, @ARGV);
exec( "$ENV{GL_BINDIR}/../src/gitolite-shell", $user );
} elsif ( $cmd eq 'push' ) {
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
$rc = system( "git", $cmd, "--receive-pack=$ENV{GL_BINDIR}/gitolite-receive-pack", @ARGV );
} else {
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
$rc = system( "git", $cmd, "--upload-pack=$ENV{GL_BINDIR}/gitolite-upload-pack", @ARGV );
}
if ( $? == -1 ) {
die "F: failed to execute: $!\n";
} elsif ( $? & 127 ) {
printf STDERR "E: child died with signal %d\n", ( $? & 127 );
exit 1;
} else {
printf STDERR "W: child exited with value %d\n", $? >> 8 if $? >> 8;
exit( $? >> 8 );
}
exit 0;