summaryrefslogtreecommitdiff
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
parentdc13dfca8fdae5634bb0865f7e9822d2a268ed59 (diff)
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' ) ) {