diff --git a/src/commands/writable b/src/commands/writable index fdaa540..d6426b2 100755 --- a/src/commands/writable +++ b/src/commands/writable @@ -25,9 +25,9 @@ my $repo = shift; my $on = ( shift eq 'on' ); if ( $repo eq '@all' ) { - die "you are not authorized\n" if $ENV{GL_USER} and not is_admin(); + _die "you are not authorized" if $ENV{GL_USER} and not is_admin(); } else { - die "you are not authorized\n" if $ENV{GL_USER} and not owns($repo); + _die "you are not authorized" if $ENV{GL_USER} and not owns($repo); } my $msg = join( " ", @ARGV ); diff --git a/src/lib/Gitolite/Common.pm b/src/lib/Gitolite/Common.pm index 5a4b4dc..947819a 100644 --- a/src/lib/Gitolite/Common.pm +++ b/src/lib/Gitolite/Common.pm @@ -64,6 +64,7 @@ sub dbg { } sub _warn { + gl_log( 'warn', @_ ); if ( $ENV{D} and $ENV{D} >= 3 ) { cluck "WARNING: ", @_, "\n"; } elsif ( defined( $ENV{D} ) ) { @@ -72,6 +73,7 @@ sub _warn { warn "WARNING: ", @_, "\n"; } } +$SIG{__WARN__} = \&_warn; sub _die { gl_log( 'die', @_ ); @@ -83,6 +85,7 @@ sub _die { die "FATAL: " . join( ",", @_ ) . "\n"; } } +$SIG{__DIE__} = \&_die; sub usage { _warn(shift) if @_; diff --git a/src/lib/Gitolite/Easy.pm b/src/lib/Gitolite/Easy.pm index 60574a0..280a924 100644 --- a/src/lib/Gitolite/Easy.pm +++ b/src/lib/Gitolite/Easy.pm @@ -25,6 +25,8 @@ package Gitolite::Easy; %rc say say2 + _die + _warn _print usage ); diff --git a/src/lib/Gitolite/Hooks/Update.pm b/src/lib/Gitolite/Hooks/Update.pm index 1fd5530..2e4fdd0 100644 --- a/src/lib/Gitolite/Hooks/Update.pm +++ b/src/lib/Gitolite/Hooks/Update.pm @@ -62,14 +62,14 @@ sub check_vrefs { } else { my ( $dummy, $pgm, @args ) = split '/', $vref; $pgm = "$ENV{GL_BINDIR}/VREF/$pgm"; - -x $pgm or die "$vref: helper program missing or unexecutable\n"; + -x $pgm or _die "$vref: helper program missing or unexecutable"; - open( my $fh, "-|", $pgm, @_, $vref, @args ) or die "$vref: can't spawn helper program: $!\n"; + open( my $fh, "-|", $pgm, @_, $vref, @args ) or _die "$vref: can't spawn helper program: $!"; while (<$fh>) { my ( $ref, $deny_message ) = split( ' ', $_, 2 ); check_vref( $aa, $ref, $deny_message ); } - close($fh) or die $! + close($fh) or _die $! ? "Error closing sort pipe: $!" : "$vref: helper program exit status $?"; } diff --git a/src/lib/Gitolite/Setup.pm b/src/lib/Gitolite/Setup.pm index 1e995c2..effdb96 100644 --- a/src/lib/Gitolite/Setup.pm +++ b/src/lib/Gitolite/Setup.pm @@ -138,7 +138,7 @@ sub setup_gladmin { tsh_try("git config --get user.name") or tsh_run( "git config user.name '$ENV{USER} on '" . `hostname` ); tsh_try("git diff --cached --quiet") or tsh_try("git commit -am 'gl-setup $argv'") - or die "setup failed to commit to the admin repo"; + or _die "setup failed to commit to the admin repo"; delete $ENV{GIT_WORK_TREE}; } diff --git a/src/triggers/post-compile/ssh-authkeys b/src/triggers/post-compile/ssh-authkeys index 7fd1e03..450144c 100755 --- a/src/triggers/post-compile/ssh-authkeys +++ b/src/triggers/post-compile/ssh-authkeys @@ -34,7 +34,6 @@ my $old_ak = slurp($akfile); my @non_gl = grep { not /^# gito.*start/ .. /^# gito.*end/ } slurp($akfile); chomp(@non_gl); my %seen = map { $_ => 'a non-gitolite key' } ( fp(@non_gl) ); -# die 1; # pubkey files chomp( my @pubkeys = `find keydir -type f -name "*.pub" | sort` );