allow user to define filenames that our hooks chain to
(although the defaults are still update.secondary and post-update.secondary if you don't do anything)
This commit is contained in:
parent
9b35f84f55
commit
344fb0a2b7
|
@ -158,6 +158,18 @@ $RSYNC_BASE = "";
|
||||||
# Please see doc/4-wildcard-repositories.mkd for details.
|
# Please see doc/4-wildcard-repositories.mkd for details.
|
||||||
$GL_WILDREPOS = 0;
|
$GL_WILDREPOS = 0;
|
||||||
|
|
||||||
|
# --------------------------------------
|
||||||
|
# HOOK CHAINING
|
||||||
|
|
||||||
|
# by default, the update hook in every repo chains to "update.secondary".
|
||||||
|
# Similarly, the post-update hook in the admin repo chains to
|
||||||
|
# "post-update.secondary". If you're fine with the defaults, there's no need
|
||||||
|
# to do anything here. However, if you want to use different names or paths,
|
||||||
|
# change these variables
|
||||||
|
|
||||||
|
# $UPDATE_CHAINS_TO = "hooks/update.secondary";
|
||||||
|
# $ADMIN_POST_UPDATE_CHAINS_TO = "hooks/post-update.secondary";
|
||||||
|
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# per perl rules, this should be the last line in such a file:
|
# per perl rules, this should be the last line in such a file:
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -131,6 +131,10 @@ if such a hook exists. People wishing to do exotic things on the server side
|
||||||
when the admin repo is pushed should see doc/shell-games.notes for how to
|
when the admin repo is pushed should see doc/shell-games.notes for how to
|
||||||
exploit this :-)
|
exploit this :-)
|
||||||
|
|
||||||
|
Finally, these names (`update.secondary` and `post-update.secondary`) are
|
||||||
|
merely the defaults. You can change them to anything you want; look in
|
||||||
|
conf/example.gitolite.rc for details.
|
||||||
|
|
||||||
#### custom git config
|
#### custom git config
|
||||||
|
|
||||||
The custom hooks feature is a blunt instrument -- all repos get the hook you
|
The custom hooks feature is a blunt instrument -- all repos get the hook you
|
||||||
|
|
|
@ -25,7 +25,7 @@ use warnings;
|
||||||
# common definitions
|
# common definitions
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
our ($GL_CONF_COMPILED);
|
our ($GL_CONF_COMPILED, $UPDATE_CHAINS_TO);
|
||||||
our %repos;
|
our %repos;
|
||||||
|
|
||||||
# people with shell access should be allowed to bypass the update hook, simply
|
# people with shell access should be allowed to bypass the update hook, simply
|
||||||
|
@ -123,7 +123,8 @@ my $log_refex = check_ref(\@allowed_refs, $ENV{GL_REPO}, (shift @refs), $perm);
|
||||||
"\t$reported_repo\t$ref\t$ENV{GL_USER}\t$log_refex\n");
|
"\t$reported_repo\t$ref\t$ENV{GL_USER}\t$log_refex\n");
|
||||||
|
|
||||||
# now chain to the local admin defined update hook, if present
|
# now chain to the local admin defined update hook, if present
|
||||||
exec "./hooks/update.secondary", @saved_ARGV
|
$UPDATE_CHAINS_TO ||= 'hooks/update.secondary';
|
||||||
if -f "hooks/update.secondary" or -l "hooks/update.secondary";
|
exec $UPDATE_CHAINS_TO, @saved_ARGV
|
||||||
|
if -f $UPDATE_CHAINS_TO or -l $UPDATE_CHAINS_TO;
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
|
@ -11,7 +11,10 @@ $GL_BINDIR/gl-compile-conf
|
||||||
|
|
||||||
cd $od
|
cd $od
|
||||||
|
|
||||||
if [ -f hooks/post-update.secondary ] || [ -L hooks/post-update.secondary ]
|
ADMIN_POST_UPDATE_CHAINS_TO=` cd;perl -e 'do ".gitolite.rc"; print $ADMIN_POST_UPDATE_CHAINS_TO'`
|
||||||
|
[ -n "$ADMIN_POST_UPDATE_CHAINS_TO" ] || ADMIN_POST_UPDATE_CHAINS_TO=hooks/post-update.secondary
|
||||||
|
|
||||||
|
if [ -f $ADMIN_POST_UPDATE_CHAINS_TO ] || [ -L $ADMIN_POST_UPDATE_CHAINS_TO ]
|
||||||
then
|
then
|
||||||
exec hooks/post-update.secondary "$@"
|
exec $ADMIN_POST_UPDATE_CHAINS_TO "$@"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue