aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2017-05-30 09:43:37 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2017-05-30 10:11:14 +0530
commit03e32746eba89468e4f2dbc40d4e4f8d95c9ab3b (patch)
tree4983093a9ce4ca03d5763fca6806aca66c1c324c
parentallow the multi hook driver to be placed elsewhere (diff)
downloadgitolite-gentoo-03e32746eba89468e4f2dbc40d4e4f8d95c9ab3b.tar.gz
gitolite-gentoo-03e32746eba89468e4f2dbc40d4e4f8d95c9ab3b.tar.bz2
gitolite-gentoo-03e32746eba89468e4f2dbc40d4e4f8d95c9ab3b.zip
fix inefficiency in repo-specific hooks
normally I don't care too much about inefficiencies that show up during a push to the gitolite-admin repo, but this one shows up even when a normal user creates a single wild-card repo -- it runs the repo-specific hooks trigger on ALL existing repos! no one noticed or complained, so perhaps it *actually* wasn't that visible a problem, but it's an easy fix anyway. (TBH, there's still a slight inefficiency. When a new (non-wild) repo is added to gitolite.conf, that particular one gets processed twice -- once in POST_CREATE, and once in POST_COMPILE... but *shrug*. If no one noticed the much bigger O(n) inefficiency we just fixed, this O(1) inefficiency hardly matters.)
-rwxr-xr-xsrc/triggers/repo-specific-hooks8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/triggers/repo-specific-hooks b/src/triggers/repo-specific-hooks
index 969c7e8..631066e 100755
--- a/src/triggers/repo-specific-hooks
+++ b/src/triggers/repo-specific-hooks
@@ -13,7 +13,13 @@ _die "repo-specific-hooks: '$rc{LOCAL_CODE}/hooks/repo-specific' does not exist
_chdir( $ENV{GL_REPO_BASE} );
-@ARGV = ("gitolite list-phy-repos | gitolite git-config -ev -r % gitolite-options\\.hook\\. |");
+if ($ARGV[0] eq 'POST_CREATE') {
+ # just the repo given in arg-2
+ @ARGV = ("gitolite git-config -ev -r $ARGV[1] gitolite-options\\.hook\\. |");
+} else {
+ # POST_COMPILE, all repos
+ @ARGV = ("gitolite list-phy-repos | gitolite git-config -ev -r % gitolite-options\\.hook\\. |");
+}
my $driver = $rc{MULTI_HOOK_DRIVER} || "$rc{LOCAL_CODE}/hooks/multi-hook-driver";
# Hook Driver