aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Lipcon <scott.lipcon@focusedsupport.com>2016-06-16 16:16:17 -0400
committerScott Lipcon <scott.lipcon@focusedsupport.com>2016-06-16 16:16:17 -0400
commit490b54023ae16c46496977649c9de821898974e0 (patch)
tree1862fec725dc3b1f6000df5ca6f422641c1cb6f5
parentperms: make '-c' required for batch mode (diff)
downloadgitolite-gentoo-490b54023ae16c46496977649c9de821898974e0.tar.gz
gitolite-gentoo-490b54023ae16c46496977649c9de821898974e0.tar.bz2
gitolite-gentoo-490b54023ae16c46496977649c9de821898974e0.zip
suppress warnings when trying to clean repo hook
suppress warning when setting the repo-specific hooks to an empty string, e.g. removing an existing hook. Specifically, we default repositories to use a repo-specific hook: repo @all option hook.post-update = jenkins this causes gitolite to output a warning that it is ignoring the attempt to set a post-update hook on the admin repository. I'd like to be able to do: repo gitolite-admin option hook.post-update = "" but the warning is printed before it realizes that the argument is empty. This patch just changes the order of the checks so that the warning is only printed if the hooks are actually defined.
-rwxr-xr-xsrc/triggers/repo-specific-hooks4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/triggers/repo-specific-hooks b/src/triggers/repo-specific-hooks
index 1158ff5..7ed28e5 100755
--- a/src/triggers/repo-specific-hooks
+++ b/src/triggers/repo-specific-hooks
@@ -34,6 +34,9 @@ while (<>) {
$hook =~ s/^gitolite-options\.hook\.//;
$hook =~ s/\..*//;
+ my @codes = split /\s+/, $codes;
+ next unless @codes;
+
# this is a special case
if ( $repo eq 'gitolite-admin' and $hook eq 'post-update' ) {
_warn "repo-specific-hooks: ignoring attempts to set post-update hook for the admin repo";
@@ -46,7 +49,6 @@ while (<>) {
next;
}
- my @codes = split /\s+/, $codes;
push @{ $repo_hooks{$repo}{$hook} }, @codes if @codes;
}