summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2017-05-30 10:30:48 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2017-05-30 19:11:22 +0530
commit8bde76d0ae029c2ed09ca8895f224ca64c836a57 (patch)
tree186e69b37b2bec2be569c8ef7d79a038dbbbeef6
parentfix inefficiency in repo-specific hooks (diff)
downloadgitolite-gentoo-8bde76d0ae029c2ed09ca8895f224ca64c836a57.tar.gz
gitolite-gentoo-8bde76d0ae029c2ed09ca8895f224ca64c836a57.tar.bz2
gitolite-gentoo-8bde76d0ae029c2ed09ca8895f224ca64c836a57.zip
allow repo-specific hooks to be organised into subdirectories
(thanks to Mathieu Arnold for catching this, and for an initial patch)
-rwxr-xr-xsrc/triggers/repo-specific-hooks5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/triggers/repo-specific-hooks b/src/triggers/repo-specific-hooks
index 631066e..bba7a58 100755
--- a/src/triggers/repo-specific-hooks
+++ b/src/triggers/repo-specific-hooks
@@ -73,7 +73,12 @@ for my $repo (keys %repo_hooks) {
}
my $src = $rc{LOCAL_CODE} . "/hooks/repo-specific/$code";
+
+ # if $code has slashes in it, flatten it for use in $dst, to avoid
+ # having to re-create those intermediate sub-directories
+ $code =~ s(/)(_)g;
my $dst = "$repo.git/hooks/$hook.$counter-$code";
+
unless ( -x $src ) {
_warn "repo-specific-hooks: '$src' doesn't exist or is not executable";
next;