aboutsummaryrefslogtreecommitdiff
path: root/t/glt
blob: b5704f5b9e8a089f400244e358fd9e04fda4d890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl
use strict;
use warnings;

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;
if ( $cmd eq 'push' ) {
    $rc = system( "git", $cmd, "--receive-pack=$ENV{HOME}/bin/gitolite-receive-pack", @ARGV );
} else {
    $rc = system( "git", $cmd, "--upload-pack=$ENV{HOME}/bin/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;