'info' command, plus lots more changes:

- usage() gets a little smarter; it now knows what function it was called
    from and tries to find a '=for function_name' chunk of data in the script

  - the various list-* functions now work off a dispatcher in Load.pm
  - (...and they all use the new usage() magic to print their helps!)

  - src/gitolite got a lot leaner due to this dispatcher

  - src/gitolite-shell became a lot more easier to read/flow

  - rc acquired '{COMMANDS}', which gitolite-shell now refers to
  - comments in the default rc file changed a bit
  - rc got a new REMOTE_COMMAND_PATT (in place of ADC_CMD_ARGS_PATT)

the rest is perltidy and stuff like that
This commit is contained in:
Sitaram Chamarty 2012-03-12 20:54:30 +05:30
parent 0aeb0cd5e2
commit 7f8020adc5
20 changed files with 317 additions and 209 deletions

View file

@ -28,32 +28,32 @@ sub update {
trace( 1, "access($ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref) -> $ret" );
_die $ret if $ret =~ /DENIED/;
check_vrefs($ref, $oldsha, $newsha, $oldtree, $newtree, $aa);
check_vrefs( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa );
exit 0;
}
sub check_vrefs {
my($ref, $oldsha, $newsha, $oldtree, $newtree, $aa) = @_;
my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = @_;
my $name_seen = 0;
for my $vref ( vrefs($ENV{GL_REPO}, $ENV{GL_USER}) ) {
trace(1, "vref=$vref");
if ($vref =~ m(^VREF/NAME/)) {
for my $vref ( vrefs( $ENV{GL_REPO}, $ENV{GL_USER} ) ) {
trace( 1, "vref=$vref" );
if ( $vref =~ m(^VREF/NAME/) ) {
# this one is special; we process it right here, and only once
next if $name_seen++;
for my $ref ( map { chomp; s(^)(VREF/NAME/); $_; } `git diff --name-only $oldtree $newtree` ) {
check_vref($aa, $ref);
check_vref( $aa, $ref );
}
} else {
my($dummy, $pgm, @args) = split '/', $vref;
my ( $dummy, $pgm, @args ) = split '/', $vref;
$pgm = "$ENV{GL_BINDIR}/VREF/$pgm";
-x $pgm or die "$vref: helper program missing or unexecutable\n";
open( my $fh, "-|", $pgm, @_, $vref, @args ) or die "$vref: can't spawn helper program: $!\n";
while (<$fh>) {
my ( $ref, $deny_message ) = split( ' ', $_, 2 );
check_vref($aa, $ref, $deny_message);
check_vref( $aa, $ref, $deny_message );
}
close($fh) or die $!
? "Error closing sort pipe: $!"
@ -63,13 +63,13 @@ sub check_vrefs {
}
sub check_vref {
my ($aa, $ref, $deny_message) = @_;
my ( $aa, $ref, $deny_message ) = @_;
my $ret = access( $ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref );
trace( 1, "access($ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref)", "-> $ret" );
_die "$ret" . ( $deny_message ? "\n$deny_message" : '' )
if $ret =~ /DENIED/ and $ret !~ /by fallthru/;
trace( 1, "remember, fallthru is success here!") if $ret =~ /by fallthru/;
if $ret =~ /DENIED/ and $ret !~ /by fallthru/;
trace( 1, "remember, fallthru is success here!" ) if $ret =~ /by fallthru/;
}
{