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

View file

@ -34,8 +34,10 @@ exit 0;
# XXX lots of stuff from gl-auth-command is missing for now...
sub in_local {
print STDERR "TRACE: gsh(", join( ")(", @ARGV ), ")\n";
print STDERR "TRACE: gsh(SOC=$ENV{SSH_ORIGINAL_COMMAND})\n";
if ($ENV{SSH_ORIGINAL_COMMAND} =~ /git-\w+-pack/) {
print STDERR "TRACE: gsh(", join( ")(", @ARGV ), ")\n";
print STDERR "TRACE: gsh(SOC=$ENV{SSH_ORIGINAL_COMMAND})\n";
}
}
sub in_http {

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 );
}

View file

@ -6,7 +6,7 @@ use warnings;
use lib "src";
use Gitolite::Test;
try 'plan 45';
try 'plan 39';
try "## info";
@ -30,32 +30,26 @@ try "
/Initialized.*empty.*t3.git/
";
try "
glt info u1; ok; gsh
/R W \t\@t1/
glt info u1; ok; /R W \t\@t1/
/R W \tt1/
/R \tt2/
!/t3/
/R W \ttesting/
glt info u2; ok; gsh
/R \t\@t1/
glt info u2; ok; /R \t\@t1/
/R \tt1/
/R W \tt2/
!/t3/
/R W \ttesting/
glt info u3; ok; gsh
/R W \tt3/
glt info u3; ok; /R W \tt3/
!/\@t1/
!/t[12]/
/R W \ttesting/
glt info u4; ok; gsh
/R \tt3/
glt info u4; ok; /R \tt3/
!/\@t1/
!/t[12]/
/R W \ttesting/
glt info u5; ok; gsh
!/t[123]/
glt info u5; ok; !/t[123]/
/R W \ttesting/
glt info u6; ok; gsh
!/t[123]/
glt info u6; ok; !/t[123]/
/R W \ttesting/
" or die;