aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaramc@gmail.com>2018-09-08 15:40:48 +0530
committerSitaram Chamarty <sitaramc@gmail.com>2018-09-08 15:40:48 +0530
commit75993386fe33d2f85caea0ea41c8e86602a8f4ef (patch)
tree3920014ff9473f34379ec2e431782b9ff685d00c
parentprevent access to repos which are in the process of bring migrated (diff)
downloadgitolite-gentoo-75993386fe33d2f85caea0ea41c8e86602a8f4ef.tar.gz
gitolite-gentoo-75993386fe33d2f85caea0ea41c8e86602a8f4ef.tar.bz2
gitolite-gentoo-75993386fe33d2f85caea0ea41c8e86602a8f4ef.zip
warn about unknown triggers
David Bremner found that 'gitolite trigger foo', where foo is some arbitrary string, silently no-ops. The "gitolite trigger X" command only makes sense when X is POST_COMPILE or POST_CREATE, or, if it's a custom trigger type [1], when there is a section with that name in the rc file with a list of scripts to run. Anything else is an error, and should not silently no-op. [1]: for example, http://gitolite.com/gitolite/odds-and-ends/#using-pubkeys-obtained-from-elsewhere
-rwxr-xr-xsrc/gitolite5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gitolite b/src/gitolite
index 4a4cbf5..c11e047 100755
--- a/src/gitolite
+++ b/src/gitolite
@@ -71,6 +71,11 @@ if ( $command eq 'setup' ) {
compile(@args);
} elsif ( $command eq 'trigger' ) {
+ my $s = $args[0];
+ _die "trigger section '$s' not found in rc"
+ unless $s eq 'POST_COMPILE'
+ or $s eq 'POST_CREATE'
+ or ( exists $rc{$s} and ref( $rc{$s} ) eq 'ARRAY' );
trigger(@args);
} elsif ( my $c = _which( "commands/$command", 'x' ) ) {