update hook: bypass check needs to go into BEGIN block

This commit is contained in:
Sitaram Chamarty 2011-02-12 20:55:34 +05:30
parent 948f700c7a
commit a10287a4cd

View file

@ -11,6 +11,10 @@ use warnings;
# ----------------------------------------------------------------------------
BEGIN {
# people with shell access should be allowed to bypass the update hook,
# simply by setting an env var that the ssh "front door" will never set
exit 0 if exists $ENV{GL_BYPASS_UPDATE_HOOK};
die "ENV GL_RC not set\n" unless $ENV{GL_RC};
die "ENV GL_BINDIR not set\n" unless $ENV{GL_BINDIR};
}
@ -23,10 +27,6 @@ use gitolite qw(:DEFAULT %repos);
# start...
# ----------------------------------------------------------------------------
# people with shell access should be allowed to bypass the update hook, simply
# by setting an env var that the ssh "front door" will never set
exit 0 if exists $ENV{GL_BYPASS_UPDATE_HOOK};
my ($perm, $creator, $wild) = repo_rights($ENV{GL_REPO});
my $reported_repo = $ENV{GL_REPO} . ( $wild ? " ($wild)" : "" );