2012-03-08 09:00:13 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2012-03-10 14:26:29 +01:00
|
|
|
use FindBin;
|
|
|
|
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
|
|
|
|
|
2012-03-08 09:00:13 +01:00
|
|
|
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
|
|
|
|
|
|
|
|
my $cmd = shift or die "need command";
|
|
|
|
my $user = shift or die "need user";
|
|
|
|
my $rc;
|
|
|
|
|
|
|
|
$ENV{G3T_USER} = $user;
|
2012-03-12 16:24:30 +01:00
|
|
|
if ($cmd eq 'info' ) {
|
|
|
|
$ENV{SSH_ORIGINAL_COMMAND} = $cmd;
|
|
|
|
exec( "$ENV{GL_BINDIR}/../src/gitolite-shell", $user );
|
|
|
|
} elsif ( $cmd eq 'push' ) {
|
2012-03-10 14:26:29 +01:00
|
|
|
$rc = system( "git", $cmd, "--receive-pack=$ENV{GL_BINDIR}/gitolite-receive-pack", @ARGV );
|
2012-03-08 09:00:13 +01:00
|
|
|
} else {
|
2012-03-10 14:26:29 +01:00
|
|
|
$rc = system( "git", $cmd, "--upload-pack=$ENV{GL_BINDIR}/gitolite-upload-pack", @ARGV );
|
2012-03-08 09:00:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|