diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2010-04-13 18:26:34 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2010-04-13 18:26:34 +0530 |
commit | 344fb0a2b729a87590a98e1e3cb04267de1303b7 (patch) | |
tree | 56d7fd1a4988824f3721ace965c02ce7771bbd16 | |
parent | fix bug in 7bfb367 that causes "@all.git" to be created! (diff) | |
download | gitolite-gentoo-344fb0a2b729a87590a98e1e3cb04267de1303b7.tar.gz gitolite-gentoo-344fb0a2b729a87590a98e1e3cb04267de1303b7.tar.bz2 gitolite-gentoo-344fb0a2b729a87590a98e1e3cb04267de1303b7.zip |
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)
-rw-r--r-- | conf/example.gitolite.rc | 12 | ||||
-rw-r--r-- | doc/2-admin.mkd | 4 | ||||
-rwxr-xr-x | hooks/common/update | 7 | ||||
-rwxr-xr-x | hooks/gitolite-admin/post-update | 7 |
4 files changed, 25 insertions, 5 deletions
diff --git a/conf/example.gitolite.rc b/conf/example.gitolite.rc index bda9d2d..b1a921f 100644 --- a/conf/example.gitolite.rc +++ b/conf/example.gitolite.rc @@ -159,6 +159,18 @@ $RSYNC_BASE = ""; $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: 1; diff --git a/doc/2-admin.mkd b/doc/2-admin.mkd index 4190fc6..4b27d59 100644 --- a/doc/2-admin.mkd +++ b/doc/2-admin.mkd @@ -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 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 The custom hooks feature is a blunt instrument -- all repos get the hook you diff --git a/hooks/common/update b/hooks/common/update index 2a3e3e6..dc87d03 100755 --- a/hooks/common/update +++ b/hooks/common/update @@ -25,7 +25,7 @@ use warnings; # common definitions # ---------------------------------------------------------------------------- -our ($GL_CONF_COMPILED); +our ($GL_CONF_COMPILED, $UPDATE_CHAINS_TO); our %repos; # 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"); # now chain to the local admin defined update hook, if present -exec "./hooks/update.secondary", @saved_ARGV - if -f "hooks/update.secondary" or -l "hooks/update.secondary"; +$UPDATE_CHAINS_TO ||= 'hooks/update.secondary'; +exec $UPDATE_CHAINS_TO, @saved_ARGV + if -f $UPDATE_CHAINS_TO or -l $UPDATE_CHAINS_TO; exit 0; diff --git a/hooks/gitolite-admin/post-update b/hooks/gitolite-admin/post-update index 8fcb182..891c273 100755 --- a/hooks/gitolite-admin/post-update +++ b/hooks/gitolite-admin/post-update @@ -11,7 +11,10 @@ $GL_BINDIR/gl-compile-conf 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 - exec hooks/post-update.secondary "$@" + exec $ADMIN_POST_UPDATE_CHAINS_TO "$@" fi |