glt learns to deal better with non-git commands

This commit is contained in:
Sitaram Chamarty 2012-03-18 10:01:07 +05:30
parent e743cab1a3
commit c79f9d2381
3 changed files with 20 additions and 19 deletions

13
t/glt
View file

@ -5,19 +5,24 @@ use warnings;
use FindBin;
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
my $cmd = shift or die "need command";
my $user = shift or die "need user";
my $rc;
my %extcmds = (
info => 1,
perms => 1,
);
$ENV{G3T_USER} = $user;
if ($cmd eq 'info' ) {
$ENV{SSH_ORIGINAL_COMMAND} = $cmd;
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 );
}