diff --git a/src/Gitolite/Common.pm b/src/Gitolite/Common.pm index 5122a05..a80b2db 100644 --- a/src/Gitolite/Common.pm +++ b/src/Gitolite/Common.pm @@ -44,8 +44,8 @@ sub trace { my $level = shift; return if $ENV{D} < $level; my $args = ''; $args = join( ", ", @_ ) if @_; my $sub = ( caller 1 )[3] || ''; $sub =~ s/.*://; - if (not $sub) { - $sub = ( caller )[1]; + if ( not $sub ) { + $sub = (caller)[1]; $sub =~ s(.*/(.*))(($1)); } $sub .= ' ' x ( 32 - length($sub) ); @@ -72,7 +72,7 @@ sub _warn { } sub _die { - gl_log("_die:", @_); + gl_log( "_die:", @_ ); if ( $ENV{D} and $ENV{D} >= 3 ) { confess "FATAL: " . join( ",", @_ ) . "\n" if defined( $ENV{D} ); } elsif ( defined( $ENV{D} ) ) { @@ -116,7 +116,7 @@ sub _system { # run system(), catch errors. Be verbose only if $ENV{D} exists. If not, # exit with if it applies, else just "exit 1". trace( 2, @_ ); - gl_log("_system:", @_); + gl_log( "_system:", @_ ); if ( system(@_) != 0 ) { trace( 1, "system() failed", @_, "-> $?" ); if ( $? == -1 ) { @@ -212,35 +212,35 @@ sub cleanup_conf_line { # generate a timestamp. If a template is passed generate a log file name # based on it also sub gen_ts_lfn { - my ($s, $min, $h, $d, $m, $y) = (localtime)[0..5]; - $y += 1900; $m++; # usual adjustments - for ($s, $min, $h, $d, $m) { + my ( $s, $min, $h, $d, $m, $y ) = (localtime)[ 0 .. 5 ]; + $y += 1900; $m++; # usual adjustments + for ( $s, $min, $h, $d, $m ) { $_ = "0$_" if $_ < 10; } my $ts = "$y-$m-$d.$h:$min:$s"; return $ts unless @_; - my($template) = shift; + my ($template) = shift; # substitute template parameters and set the logfile name $template =~ s/%y/$y/g; $template =~ s/%m/$m/g; $template =~ s/%d/$d/g; - return ($ts, $template); + return ( $ts, $template ); } sub gl_log { # the log filename and the timestamp come from the environment. If we get # called even before they are set, we have no choice but to dump to STDERR # (and probably call "logger"). - my $msg = join("\t", @_); + my $msg = join( "\t", @_ ); my $ts = $ENV{GL_TS} || gen_ts_lfn(); my $fh; - logger_plus_stderr("$ts no GL_LOGFILE env var", "$ts $msg") if not $ENV{GL_LOGFILE}; - open my $lfh, ">>", $ENV{GL_LOGFILE} or logger_plus_stderr("open log failed: $!", $msg); + logger_plus_stderr( "$ts no GL_LOGFILE env var", "$ts $msg" ) if not $ENV{GL_LOGFILE}; + open my $lfh, ">>", $ENV{GL_LOGFILE} or logger_plus_stderr( "open log failed: $!", $msg ); print $lfh "$ts\t$msg\n"; close $lfh; } diff --git a/src/Gitolite/Conf/Store.pm b/src/Gitolite/Conf/Store.pm index b3aa087..919e33c 100644 --- a/src/Gitolite/Conf/Store.pm +++ b/src/Gitolite/Conf/Store.pm @@ -199,13 +199,13 @@ sub new_wild_repo { my ( $repo, $user ) = @_; _chdir( $rc{GL_REPO_BASE} ); - trigger('PRE_CREATE', $repo, $user); + trigger( 'PRE_CREATE', $repo, $user ); new_repo($repo); _print( "$repo.git/gl-creator", $user ); _print( "$repo.git/gl-perms", "$rc{DEFAULT_ROLE_PERMS}\n" ) if $rc{DEFAULT_ROLE_PERMS}; # XXX git config, daemon, web... # XXX pre-create, post-create - trigger('POST_CREATE', $repo, $user); + trigger( 'POST_CREATE', $repo, $user ); _chdir( $rc{GL_ADMIN_BASE} ); } diff --git a/src/Gitolite/Conf/Sugar.pm b/src/Gitolite/Conf/Sugar.pm index 04a5e1e..60f0b8d 100644 --- a/src/Gitolite/Conf/Sugar.pm +++ b/src/Gitolite/Conf/Sugar.pm @@ -183,9 +183,9 @@ sub role_names { for my $line (@$lines) { if ( $line =~ /^(-|C|R|RW\+?(?:C?D?|D?C?)M?) (.* )?= (.+)/ ) { - my($p, $r) = ($1, $2); + my ( $p, $r ) = ( $1, $2 ); my $u = ''; - for (split ' ', $3) { + for ( split ' ', $3 ) { $_ = "\@$_" if $_ eq 'CREATOR' or $rc{ROLES}{$_}; $u .= " $_"; } diff --git a/src/Gitolite/Hooks/Update.pm b/src/Gitolite/Hooks/Update.pm index c66cafb..dae4412 100644 --- a/src/Gitolite/Hooks/Update.pm +++ b/src/Gitolite/Hooks/Update.pm @@ -29,7 +29,7 @@ sub update { my $ret = access( $ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref ); trace( 1, "access($ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref)", "-> $ret" ); gl_log( 'update:check', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref, '->', $ret ); - trigger('ACCESS_CHECK', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref, $ret); + trigger( 'ACCESS_CHECK', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, $ref, $ret ); _die $ret if $ret =~ /DENIED/; check_vrefs( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ); diff --git a/src/gitolite-shell b/src/gitolite-shell index 89f5fca..eac506d 100755 --- a/src/gitolite-shell +++ b/src/gitolite-shell @@ -34,7 +34,7 @@ exit 0; # XXX lots of stuff from gl-auth-command is missing for now... sub in_local { - if ($ENV{SSH_ORIGINAL_COMMAND} =~ /git-\w+-pack/) { + 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"; } @@ -79,13 +79,13 @@ sub main { my $ret = access( $repo, $user, $aa, 'any' ); trace( 1, "access($repo, $user, $aa, 'any')", "-> $ret" ); gl_log( 'gitolite-shell:check', $repo, $user, $aa, 'any', '->', $ret ); - trigger('ACCESS_CHECK', $repo, $user, $aa, 'any', $ret); + trigger( 'ACCESS_CHECK', $repo, $user, $aa, 'any', $ret ); _die $ret if $ret =~ /DENIED/; $repo = "'$rc{GL_REPO_BASE}/$repo.git'"; - trigger('PRE_GIT', $repo, $user, $aa, 'any', $verb); + trigger( 'PRE_GIT', $repo, $user, $aa, 'any', $verb ); _system( "git", "shell", "-c", "$verb $repo" ); - trigger('POST_GIT', $repo, $user, $aa, 'any', $verb); + trigger( 'POST_GIT', $repo, $user, $aa, 'any', $verb ); } # ----------------------------------------------------------------------