glt learns to deal better with non-git commands
This commit is contained in:
parent
e743cab1a3
commit
c79f9d2381
|
@ -34,8 +34,10 @@ exit 0;
|
||||||
# XXX lots of stuff from gl-auth-command is missing for now...
|
# XXX lots of stuff from gl-auth-command is missing for now...
|
||||||
|
|
||||||
sub in_local {
|
sub in_local {
|
||||||
print STDERR "TRACE: gsh(", join( ")(", @ARGV ), ")\n";
|
if ($ENV{SSH_ORIGINAL_COMMAND} =~ /git-\w+-pack/) {
|
||||||
print STDERR "TRACE: gsh(SOC=$ENV{SSH_ORIGINAL_COMMAND})\n";
|
print STDERR "TRACE: gsh(", join( ")(", @ARGV ), ")\n";
|
||||||
|
print STDERR "TRACE: gsh(SOC=$ENV{SSH_ORIGINAL_COMMAND})\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub in_http {
|
sub in_http {
|
||||||
|
|
13
t/glt
13
t/glt
|
@ -5,19 +5,24 @@ use warnings;
|
||||||
use FindBin;
|
use FindBin;
|
||||||
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
|
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin; }
|
||||||
|
|
||||||
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
|
|
||||||
|
|
||||||
my $cmd = shift or die "need command";
|
my $cmd = shift or die "need command";
|
||||||
my $user = shift or die "need user";
|
my $user = shift or die "need user";
|
||||||
my $rc;
|
my $rc;
|
||||||
|
|
||||||
|
my %extcmds = (
|
||||||
|
info => 1,
|
||||||
|
perms => 1,
|
||||||
|
);
|
||||||
|
|
||||||
$ENV{G3T_USER} = $user;
|
$ENV{G3T_USER} = $user;
|
||||||
if ($cmd eq 'info' ) {
|
if ($extcmds{$cmd}) {
|
||||||
$ENV{SSH_ORIGINAL_COMMAND} = $cmd;
|
$ENV{SSH_ORIGINAL_COMMAND} = join(" ", $cmd, @ARGV);
|
||||||
exec( "$ENV{GL_BINDIR}/../src/gitolite-shell", $user );
|
exec( "$ENV{GL_BINDIR}/../src/gitolite-shell", $user );
|
||||||
} elsif ( $cmd eq 'push' ) {
|
} elsif ( $cmd eq 'push' ) {
|
||||||
|
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
|
||||||
$rc = system( "git", $cmd, "--receive-pack=$ENV{GL_BINDIR}/gitolite-receive-pack", @ARGV );
|
$rc = system( "git", $cmd, "--receive-pack=$ENV{GL_BINDIR}/gitolite-receive-pack", @ARGV );
|
||||||
} else {
|
} else {
|
||||||
|
print STDERR "TRACE: glt(", join( ")(", @ARGV ), ")\n";
|
||||||
$rc = system( "git", $cmd, "--upload-pack=$ENV{GL_BINDIR}/gitolite-upload-pack", @ARGV );
|
$rc = system( "git", $cmd, "--upload-pack=$ENV{GL_BINDIR}/gitolite-upload-pack", @ARGV );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
t/info.t
20
t/info.t
|
@ -6,7 +6,7 @@ use warnings;
|
||||||
use lib "src";
|
use lib "src";
|
||||||
use Gitolite::Test;
|
use Gitolite::Test;
|
||||||
|
|
||||||
try 'plan 45';
|
try 'plan 39';
|
||||||
|
|
||||||
try "## info";
|
try "## info";
|
||||||
|
|
||||||
|
@ -30,32 +30,26 @@ try "
|
||||||
/Initialized.*empty.*t3.git/
|
/Initialized.*empty.*t3.git/
|
||||||
";
|
";
|
||||||
try "
|
try "
|
||||||
glt info u1; ok; gsh
|
glt info u1; ok; /R W \t\@t1/
|
||||||
/R W \t\@t1/
|
|
||||||
/R W \tt1/
|
/R W \tt1/
|
||||||
/R \tt2/
|
/R \tt2/
|
||||||
!/t3/
|
!/t3/
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
glt info u2; ok; gsh
|
glt info u2; ok; /R \t\@t1/
|
||||||
/R \t\@t1/
|
|
||||||
/R \tt1/
|
/R \tt1/
|
||||||
/R W \tt2/
|
/R W \tt2/
|
||||||
!/t3/
|
!/t3/
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
glt info u3; ok; gsh
|
glt info u3; ok; /R W \tt3/
|
||||||
/R W \tt3/
|
|
||||||
!/\@t1/
|
!/\@t1/
|
||||||
!/t[12]/
|
!/t[12]/
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
glt info u4; ok; gsh
|
glt info u4; ok; /R \tt3/
|
||||||
/R \tt3/
|
|
||||||
!/\@t1/
|
!/\@t1/
|
||||||
!/t[12]/
|
!/t[12]/
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
glt info u5; ok; gsh
|
glt info u5; ok; !/t[123]/
|
||||||
!/t[123]/
|
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
glt info u6; ok; gsh
|
glt info u6; ok; !/t[123]/
|
||||||
!/t[123]/
|
|
||||||
/R W \ttesting/
|
/R W \ttesting/
|
||||||
" or die;
|
" or die;
|
||||||
|
|
Loading…
Reference in a new issue