GL_BYPASS_UPDATE_HOOK -> GL_BYPASS_ACCESS_CHECKS, also added to gitolite-shell

This commit is contained in:
Sitaram Chamarty 2012-03-28 15:25:32 +05:30
parent c2991d974d
commit a439f47a67
3 changed files with 9 additions and 7 deletions

View file

@ -144,7 +144,7 @@ use strict;
use warnings; use warnings;
BEGIN { BEGIN {
exit 0 if $ENV{GL_BYPASS_UPDATE_HOOK}; exit 0 if $ENV{GL_BYPASS_ACCESS_CHECKS};
die "GL_BINDIR not set; aborting\n" unless $ENV{GL_BINDIR}; die "GL_BINDIR not set; aborting\n" unless $ENV{GL_BINDIR};
} }
use lib $ENV{GL_BINDIR}; use lib $ENV{GL_BINDIR};

View file

@ -21,7 +21,7 @@ main=`git config --file $GL_REPO_BASE/$repo.git/config --get gitolite.partialCop
[ -z "$main" ] && exit 0 [ -z "$main" ] && exit 0
rand=$RANDOM rand=$RANDOM
export GL_BYPASS_UPDATE_HOOK=1 export GL_BYPASS_ACCESS_CHECKS=1
git push -f $GL_REPO_BASE/$main.git $new:refs/heads/br-$rand || die "FATAL: failed to send $new" git push -f $GL_REPO_BASE/$main.git $new:refs/heads/br-$rand || die "FATAL: failed to send $new"

View file

@ -88,11 +88,13 @@ sub main {
# yet know the ref that will be eventually pushed (and even that won't # yet know the ref that will be eventually pushed (and even that won't
# apply if it's a read operation). See the matching code in access() for # apply if it's a read operation). See the matching code in access() for
# more information. # more information.
my $ret = access( $repo, $user, $aa, 'any' ); unless ($ENV{GL_BYPASS_ACCESS_CHECKS}) {
trace( 1, "access($repo, $user, $aa, 'any')", "-> $ret" ); my $ret = access( $repo, $user, $aa, 'any' );
gl_log( 'check1', $repo, $user, $aa, 'any', '->', $ret ); trace( 1, "access($repo, $user, $aa, 'any')", "-> $ret" );
trigger( 'ACCESS_1', $repo, $user, $aa, 'any', $ret ); gl_log( 'check1', $repo, $user, $aa, 'any', '->', $ret );
_die $ret . "\n(or you mis-spelled the reponame)" if $ret =~ /DENIED/; trigger( 'ACCESS_1', $repo, $user, $aa, 'any', $ret );
_die $ret . "\n(or you mis-spelled the reponame)" if $ret =~ /DENIED/;
}
trigger( 'PRE_GIT', $repo, $user, $aa, 'any', $verb ); trigger( 'PRE_GIT', $repo, $user, $aa, 'any', $verb );
my $repodir = "'$rc{GL_REPO_BASE}/$repo.git'"; my $repodir = "'$rc{GL_REPO_BASE}/$repo.git'";