(perltidy)
This commit is contained in:
parent
afcd974afa
commit
8714b77eae
|
@ -77,8 +77,8 @@ sub _die {
|
|||
sub usage {
|
||||
_warn(shift) if @_;
|
||||
my ( $script, $function ) = ( caller(1) )[ 1, 3 ];
|
||||
if (not $script) {
|
||||
$script = ( caller ) [1];
|
||||
if ( not $script ) {
|
||||
$script = (caller)[1];
|
||||
$function = 'usage';
|
||||
}
|
||||
dbg( "u s a g e", $script, $function );
|
||||
|
@ -115,7 +115,7 @@ sub _system {
|
|||
die "child died with signal " . ( $? & 127 ) . "\n" if $ENV{D};
|
||||
} else {
|
||||
die "child exited with value " . ( $? >> 8 ) . "\n" if $ENV{D};
|
||||
exit ( $? >> 8 );
|
||||
exit( $? >> 8 );
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ sub incsub {
|
|||
_die "subconf $subconf attempting to run 'subconf'\n" if $is_subconf and $subconf ne 'master';
|
||||
|
||||
_die "invalid include/subconf file/glob '$include_glob'"
|
||||
unless $include_glob =~ /^"(.+)"$/
|
||||
or $include_glob =~ /^'(.+)'$/;
|
||||
unless $include_glob =~ /^"(.+)"$/
|
||||
or $include_glob =~ /^'(.+)'$/;
|
||||
$include_glob = $1;
|
||||
|
||||
# XXX move this to Macros... substitute HOSTNAME word if GL_HOSTNAME defined, otherwise leave as is
|
||||
|
|
|
@ -67,8 +67,8 @@ sub access {
|
|||
my @rules = rules( $repo, $user );
|
||||
trace( 3, scalar(@rules) . " rules found" );
|
||||
for my $r (@rules) {
|
||||
my $perm = $r->[1];
|
||||
my $refex = $r->[2]; $refex =~ s(/USER/)(/$user/);
|
||||
my $perm = $r->[1];
|
||||
my $refex = $r->[2]; $refex =~ s(/USER/)(/$user/);
|
||||
trace( 4, "perm=$perm, refex=$refex" );
|
||||
|
||||
# skip 'deny' rules if the ref is not (yet) known
|
||||
|
|
|
@ -116,7 +116,7 @@ sub parse_users {
|
|||
|
||||
sub add_rule {
|
||||
my ( $perm, $ref, $user ) = @_;
|
||||
_die "bad ref '$ref'" unless $ref =~ $REPOPATT_PATT;
|
||||
_die "bad ref '$ref'" unless $ref =~ $REPOPATT_PATT;
|
||||
_die "bad user '$user'" unless $user =~ $USERNAME_PATT;
|
||||
|
||||
$ruleseq++;
|
||||
|
|
|
@ -53,9 +53,9 @@ _die "$rc seems to be for older gitolite" if defined($GL_ADMINDIR);
|
|||
# let values specified in rc file override our internal ones
|
||||
@rc{ keys %RC } = values %RC;
|
||||
|
||||
# testing sometimes requires all of it to be overridden silently; use an
|
||||
# env var that is highly unlikely to appear in real life :)
|
||||
do $ENV{G3T_RC} if exists $ENV{G3T_RC} and -r $ENV{G3T_RC};
|
||||
# testing sometimes requires all of it to be overridden silently; use an
|
||||
# env var that is highly unlikely to appear in real life :)
|
||||
do $ENV{G3T_RC} if exists $ENV{G3T_RC} and -r $ENV{G3T_RC};
|
||||
|
||||
# fix PATH (TODO: do it only if 'gitolite' isn't in PATH)
|
||||
$ENV{PATH} = "$ENV{GL_BINDIR}:$ENV{PATH}";
|
||||
|
|
|
@ -50,9 +50,9 @@ sub args {
|
|||
my $argv = join( " ", @ARGV );
|
||||
|
||||
GetOptions(
|
||||
'admin|a=s' => \$admin,
|
||||
'pubkey|pk=s' => \$pubkey,
|
||||
'help|h' => \$help,
|
||||
'admin|a=s' => \$admin,
|
||||
'pubkey|pk=s' => \$pubkey,
|
||||
'help|h' => \$help,
|
||||
) or usage();
|
||||
|
||||
usage() if $help or ($pubkey and $admin);
|
||||
|
@ -79,9 +79,9 @@ sub setup_glrc {
|
|||
|
||||
sub setup_gladmin {
|
||||
my ( $admin, $pubkey, $argv ) = @_;
|
||||
trace( 1, $admin || '<no admin name given>');
|
||||
trace( 1, $admin || '<no admin name given>' );
|
||||
_die "no existing conf file found, '-a' required"
|
||||
if not $admin and not -f "$rc{GL_ADMIN_BASE}/conf/gitolite.conf";
|
||||
if not $admin and not -f "$rc{GL_ADMIN_BASE}/conf/gitolite.conf";
|
||||
|
||||
# reminder: 'admin files' are in ~/.gitolite, 'admin repo' is
|
||||
# $rc{GL_REPO_BASE}/gitolite-admin.git
|
||||
|
@ -96,7 +96,7 @@ sub setup_gladmin {
|
|||
_chdir( $rc{GL_ADMIN_BASE} );
|
||||
|
||||
tsh_try("cd \$GL_BINDIR; git describe --tags --long --dirty=-dt 2>/dev/null")
|
||||
and _print("VERSION", tsh_text());
|
||||
and _print( "VERSION", tsh_text() );
|
||||
|
||||
_mkdir("conf");
|
||||
my $conf;
|
||||
|
|
|
@ -25,7 +25,7 @@ BEGIN {
|
|||
*{'try'} = \&Tsh::try;
|
||||
*{'put'} = \&Tsh::put;
|
||||
*{'text'} = \&Tsh::text;
|
||||
*{'cmp'} = \&Tsh::cmp;
|
||||
*{'cmp'} = \&Tsh::cmp;
|
||||
}
|
||||
|
||||
use strict;
|
||||
|
@ -72,12 +72,12 @@ sub dump {
|
|||
}
|
||||
|
||||
sub _confargs {
|
||||
return @_ if ($_[1]);
|
||||
return @_ if ( $_[1] );
|
||||
return 'gitolite.conf', $_[0];
|
||||
}
|
||||
|
||||
sub confreset {
|
||||
system("rm", "-rf", "conf");
|
||||
system( "rm", "-rf", "conf" );
|
||||
mkdir("conf");
|
||||
system("mv ~/repositories/gitolite-admin.git ~/repositories/.ga");
|
||||
system("mv ~/repositories/testing.git ~/repositories/.te");
|
||||
|
@ -93,7 +93,7 @@ sub confreset {
|
|||
}
|
||||
|
||||
sub confadd {
|
||||
my ($file, $string) = _confargs(@_);
|
||||
my ( $file, $string ) = _confargs(@_);
|
||||
put "|cat >> conf/$file", $string;
|
||||
}
|
||||
|
||||
|
|
|
@ -473,13 +473,13 @@ sub fail {
|
|||
sub cmp {
|
||||
# compare input string with text()
|
||||
my $text = text();
|
||||
my $in = shift;
|
||||
my $in = shift;
|
||||
|
||||
if ($text eq $in) {
|
||||
if ( $text eq $in ) {
|
||||
ok();
|
||||
} else {
|
||||
fail('cmp failed', '');
|
||||
dbg(4, "\n\ntext = <<<$text>>>, in = <<<$in>>>\n\n");
|
||||
fail( 'cmp failed', '' );
|
||||
dbg( 4, "\n\ntext = <<<$text>>>, in = <<<$in>>>\n\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ my $ret = '';
|
|||
|
||||
$ret = access( $repo, $user, $aa, $ref );
|
||||
|
||||
if ($ret =~ /DENIED/) {
|
||||
if ( $ret =~ /DENIED/ ) {
|
||||
print "$ret\n" unless $quiet;
|
||||
exit 1;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ usage() if @ARGV;
|
|||
my $user = $ENV{GL_USER} or _die "GL_USER not set";
|
||||
my $ref = 'any';
|
||||
|
||||
print "hello $user, this is gitolite3 " . version() . " on git " . substr(`git --version`, 12) . "\n";
|
||||
print "hello $user, this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
|
||||
|
||||
my $lr = lister_dispatch('list-repos');
|
||||
my $lm = lister_dispatch('list-members');
|
||||
|
@ -27,7 +27,7 @@ my $lm = lister_dispatch('list-members');
|
|||
for ( @{ $lr->() } ) {
|
||||
my $perm = '';
|
||||
for my $aa (qw(R W ^C)) {
|
||||
my $ret = access($_, $user, $aa, $ref);
|
||||
my $ret = access( $_, $user, $aa, $ref );
|
||||
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
|
||||
}
|
||||
next unless $perm =~ /\S/;
|
||||
|
|
|
@ -103,11 +103,11 @@ the gitolite-admin repo).
|
|||
sub post_compile {
|
||||
usage() if ( not @_ or $_[0] eq '-h' );
|
||||
|
||||
run_subdir('post-compile', @_);
|
||||
run_subdir( 'post-compile', @_ );
|
||||
}
|
||||
|
||||
sub run_command {
|
||||
run_subdir('commands', @_);
|
||||
run_subdir( 'commands', @_ );
|
||||
}
|
||||
|
||||
sub run_subdir {
|
||||
|
|
|
@ -54,7 +54,7 @@ sub main {
|
|||
my $user = $ENV{GL_USER} = shift @ARGV;
|
||||
|
||||
# set up the repo and the attempted access
|
||||
my ( $verb, $repo ) = parse_soc(); # returns only for git commands
|
||||
my ( $verb, $repo ) = parse_soc(); # returns only for git commands
|
||||
sanity($repo);
|
||||
$ENV{GL_REPO} = $repo;
|
||||
my $aa = ( $verb =~ 'upload' ? 'R' : 'W' );
|
||||
|
@ -79,9 +79,9 @@ sub parse_soc {
|
|||
|
||||
if ( $soc =~ m(^(git-(?:upload|receive)-pack) '/?(.*?)(?:\.git)?'$) ) {
|
||||
# TODO git archive
|
||||
my($verb, $repo) = ($1, $2);
|
||||
my ( $verb, $repo ) = ( $1, $2 );
|
||||
_die "invalid repo name: '$repo'" if $repo !~ $REPONAME_PATT;
|
||||
return ($verb, $repo);
|
||||
return ( $verb, $repo );
|
||||
}
|
||||
|
||||
# after this we should not return; caller expects us to handle it all here
|
||||
|
@ -90,8 +90,8 @@ sub parse_soc {
|
|||
_die "suspicious characters loitering about '$soc'" if $soc !~ $REMOTE_COMMAND_PATT;
|
||||
|
||||
my @words = split ' ', $soc;
|
||||
if ($rc{COMMANDS}{$words[0]}) {
|
||||
_system("gitolite", @words);
|
||||
if ( $rc{COMMANDS}{ $words[0] } ) {
|
||||
_system( "gitolite", @words );
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ $|++;
|
|||
# can be called directly, or as a post-update hook. Since it ignores
|
||||
# arguments anyway, it hardly matters.
|
||||
|
||||
my $ab = `gitolite query-rc -n GL_ADMIN_BASE`;
|
||||
my $ab = `gitolite query-rc -n GL_ADMIN_BASE`;
|
||||
_warn("'keydir' not found in '$ab'"), exit if not -d "$ab/keydir";
|
||||
my $akfile = "$ENV{HOME}/.ssh/authorized_keys";
|
||||
my $glshell = `gitolite query-rc -n GL_BINDIR` . "/gitolite-shell";
|
||||
|
|
|
@ -9,21 +9,21 @@
|
|||
sub sugar_script {
|
||||
my $lines = shift;
|
||||
|
||||
my @out = @{ $lines };
|
||||
my @out = @{$lines};
|
||||
unshift @out, groupnames();
|
||||
|
||||
return \@out;
|
||||
}
|
||||
|
||||
sub groupnames {
|
||||
my @out = ();
|
||||
my @out = ();
|
||||
my %members = ();
|
||||
for my $pk (`find ../keydir/ -name "*.pub"`) {
|
||||
next unless $pk =~ m(.*/([^/]+)/([^/]+)\.pub$);
|
||||
next if $1 eq 'keydir';
|
||||
$members{$1} .= " $2";
|
||||
}
|
||||
for my $m (sort keys %members) {
|
||||
for my $m ( sort keys %members ) {
|
||||
push @out, "\@$m =" . $members{$m};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue