diff --git a/src/Gitolite/Hooks/Update.pm b/src/Gitolite/Hooks/Update.pm index 262f566..7cb17b1 100644 --- a/src/Gitolite/Hooks/Update.pm +++ b/src/Gitolite/Hooks/Update.pm @@ -22,6 +22,8 @@ use warnings; sub update { # this is the *real* update hook for gitolite + bypass() if $ENV{GL_BYPASS_ACCESS_CHECKS}; + my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = args(@ARGV); trace( 1, 'update', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, @ARGV ); @@ -37,6 +39,13 @@ sub update { exit 0; } +sub bypass { + require Cwd; + Cwd->import; + gl_log( 'update', getcwd(), '(' . ($ENV{USER} || '?') . ')', 'bypass', @ARGV ); + exit 0; +} + sub check_vrefs { my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = @_; my $name_seen = 0; @@ -143,10 +152,6 @@ __DATA__ use strict; use warnings; -BEGIN { - exit 0 if $ENV{GL_BYPASS_ACCESS_CHECKS}; - die "GL_BINDIR not set; aborting\n" unless $ENV{GL_BINDIR}; -} use lib $ENV{GL_BINDIR}; use Gitolite::Hooks::Update; diff --git a/src/commands/push b/src/commands/push new file mode 100755 index 0000000..f97f730 --- /dev/null +++ b/src/commands/push @@ -0,0 +1,5 @@ +#!/bin/sh + +export GL_BYPASS_ACCESS_CHECKS=1 + +git push "$@"