diff options
author | 2018-01-31 14:09:08 +0530 | |
---|---|---|
committer | 2018-02-11 11:45:39 +0530 | |
commit | 7898f9b020e8106e5165d547ce97e4ef6a0f5d7e (patch) | |
tree | ed02c6aa735f90b2be771b8a2408509ea3eaa13b /src | |
parent | clean up previous patch on handling trailing slashes (diff) | |
download | gitolite-gentoo-7898f9b020e8106e5165d547ce97e4ef6a0f5d7e.tar.gz gitolite-gentoo-7898f9b020e8106e5165d547ce97e4ef6a0f5d7e.tar.bz2 gitolite-gentoo-7898f9b020e8106e5165d547ce97e4ef6a0f5d7e.zip |
fix bug when deleting ALL hooks for a repo
Diffstat (limited to 'src')
-rwxr-xr-x | src/triggers/repo-specific-hooks | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/triggers/repo-specific-hooks b/src/triggers/repo-specific-hooks index a4c86cc..7c16f2f 100755 --- a/src/triggers/repo-specific-hooks +++ b/src/triggers/repo-specific-hooks @@ -41,21 +41,23 @@ while (<>) { $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"; - next; - } + # check for disallowed hook types only if @codes is non-empty + if (@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"; + next; + } - unless ( $hook =~ /^(pre-receive|post-receive|post-update|pre-auto-gc)$/ ) { - _warn "repo-specific-hooks: '$hook' is not allowed, ignoring"; - _warn " (only pre-receive, post-receive, post-update, and pre-auto-gc are allowed)"; - next; + unless ( $hook =~ /^(pre-receive|post-receive|post-update|pre-auto-gc)$/ ) { + _warn "repo-specific-hooks: '$hook' is not allowed, ignoring"; + _warn " (only pre-receive, post-receive, post-update, and pre-auto-gc are allowed)"; + next; + } } - push @{ $repo_hooks{$repo}{$hook} }, @codes if @codes; + push @{ $repo_hooks{$repo}{$hook} }, @codes; } for my $repo (keys %repo_hooks) { |