From 35953a5bd34f7a2bbfbc6793ad90b6644ce9b083 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 3 Apr 2012 13:27:19 +0530 Subject: [PATCH] added 'gitolite push' to make server side pushes easier... also force the update hook to log SHAs of bypassed pushes --- src/Gitolite/Hooks/Update.pm | 13 +++++++++---- src/commands/push | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100755 src/commands/push 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 "$@"