From 8714b77eae6b80287b36d532e1b16bb7045a80e6 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Thu, 15 Mar 2012 20:04:30 +0530 Subject: [PATCH] (perltidy) --- src/Gitolite/Common.pm | 6 +++--- src/Gitolite/Conf/Explode.pm | 4 ++-- src/Gitolite/Conf/Load.pm | 4 ++-- src/Gitolite/Conf/Store.pm | 2 +- src/Gitolite/Rc.pm | 6 +++--- src/Gitolite/Setup.pm | 12 ++++++------ src/Gitolite/Test.pm | 8 ++++---- src/Gitolite/Test/Tsh.pm | 8 ++++---- src/commands/access | 2 +- src/commands/info | 4 ++-- src/gitolite | 4 ++-- src/gitolite-shell | 10 +++++----- src/post-compile/ssh-authkeys | 2 +- src/syntactic-sugar/keysubdirs-as-groups | 6 +++--- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Gitolite/Common.pm b/src/Gitolite/Common.pm index 6fcfcc6..3c29ccf 100644 --- a/src/Gitolite/Common.pm +++ b/src/Gitolite/Common.pm @@ -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; } diff --git a/src/Gitolite/Conf/Explode.pm b/src/Gitolite/Conf/Explode.pm index f77e89d..07140bd 100644 --- a/src/Gitolite/Conf/Explode.pm +++ b/src/Gitolite/Conf/Explode.pm @@ -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 diff --git a/src/Gitolite/Conf/Load.pm b/src/Gitolite/Conf/Load.pm index 3d73ca7..f2ed36b 100644 --- a/src/Gitolite/Conf/Load.pm +++ b/src/Gitolite/Conf/Load.pm @@ -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 diff --git a/src/Gitolite/Conf/Store.pm b/src/Gitolite/Conf/Store.pm index fef1746..33dc003 100644 --- a/src/Gitolite/Conf/Store.pm +++ b/src/Gitolite/Conf/Store.pm @@ -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++; diff --git a/src/Gitolite/Rc.pm b/src/Gitolite/Rc.pm index f276fc2..2da9700 100644 --- a/src/Gitolite/Rc.pm +++ b/src/Gitolite/Rc.pm @@ -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}"; diff --git a/src/Gitolite/Setup.pm b/src/Gitolite/Setup.pm index 3b5f37a..c0cab3e 100644 --- a/src/Gitolite/Setup.pm +++ b/src/Gitolite/Setup.pm @@ -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 || ''); + trace( 1, $admin || '' ); _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; diff --git a/src/Gitolite/Test.pm b/src/Gitolite/Test.pm index 5654477..331c886 100644 --- a/src/Gitolite/Test.pm +++ b/src/Gitolite/Test.pm @@ -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; } diff --git a/src/Gitolite/Test/Tsh.pm b/src/Gitolite/Test/Tsh.pm index 491ee59..1a1711f 100644 --- a/src/Gitolite/Test/Tsh.pm +++ b/src/Gitolite/Test/Tsh.pm @@ -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" ); } } diff --git a/src/commands/access b/src/commands/access index f59ac6b..ec97046 100755 --- a/src/commands/access +++ b/src/commands/access @@ -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; } diff --git a/src/commands/info b/src/commands/info index 726b0d8..65e7f30 100755 --- a/src/commands/info +++ b/src/commands/info @@ -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/; diff --git a/src/gitolite b/src/gitolite index c265bd5..dd41495 100755 --- a/src/gitolite +++ b/src/gitolite @@ -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 { diff --git a/src/gitolite-shell b/src/gitolite-shell index c291bc9..6668f6a 100755 --- a/src/gitolite-shell +++ b/src/gitolite-shell @@ -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; } diff --git a/src/post-compile/ssh-authkeys b/src/post-compile/ssh-authkeys index 5e5ad4b..a286a74 100755 --- a/src/post-compile/ssh-authkeys +++ b/src/post-compile/ssh-authkeys @@ -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"; diff --git a/src/syntactic-sugar/keysubdirs-as-groups b/src/syntactic-sugar/keysubdirs-as-groups index d16dc78..83a9b77 100755 --- a/src/syntactic-sugar/keysubdirs-as-groups +++ b/src/syntactic-sugar/keysubdirs-as-groups @@ -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}; }