added 'gitolite push' to make server side pushes easier...

also force the update hook to log SHAs of bypassed pushes
This commit is contained in:
Sitaram Chamarty 2012-04-03 13:27:19 +05:30
parent ad77cef7de
commit 35953a5bd3
2 changed files with 14 additions and 4 deletions

View file

@ -22,6 +22,8 @@ use warnings;
sub update { sub update {
# this is the *real* update hook for gitolite # this is the *real* update hook for gitolite
bypass() if $ENV{GL_BYPASS_ACCESS_CHECKS};
my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = args(@ARGV); my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = args(@ARGV);
trace( 1, 'update', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, @ARGV ); trace( 1, 'update', $ENV{GL_REPO}, $ENV{GL_USER}, $aa, @ARGV );
@ -37,6 +39,13 @@ sub update {
exit 0; exit 0;
} }
sub bypass {
require Cwd;
Cwd->import;
gl_log( 'update', getcwd(), '(' . ($ENV{USER} || '?') . ')', 'bypass', @ARGV );
exit 0;
}
sub check_vrefs { sub check_vrefs {
my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = @_; my ( $ref, $oldsha, $newsha, $oldtree, $newtree, $aa ) = @_;
my $name_seen = 0; my $name_seen = 0;
@ -143,10 +152,6 @@ __DATA__
use strict; use strict;
use warnings; 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 lib $ENV{GL_BINDIR};
use Gitolite::Hooks::Update; use Gitolite::Hooks::Update;

5
src/commands/push Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
export GL_BYPASS_ACCESS_CHECKS=1
git push "$@"