From 75993386fe33d2f85caea0ea41c8e86602a8f4ef Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sat, 8 Sep 2018 15:40:48 +0530 Subject: 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 --- src/gitolite | 5 +++++ 1 file changed, 5 insertions(+) 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' ) ) { -- cgit v1.2.3-65-gdbad