mirror of
https://github.com/git/git.git
synced 2026-03-10 17:18:43 +01:00
hook: detect & emit two more bugs
Trigger a bug when an unknown hook type is encountered while setting up hook execution. Also issue a bug if a configured hook is enabled without a cmd. Mostly useful for defensive coding. Suggested-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
90f98a0d47
commit
c694016e61
4
hook.c
4
hook.c
@@ -408,7 +408,11 @@ static int pick_next_hook(struct child_process *cp,
|
||||
} else if (h->kind == HOOK_CONFIGURED) {
|
||||
/* to enable oneliners, let config-specified hooks run in shell. */
|
||||
cp->use_shell = true;
|
||||
if (!h->u.configured.command)
|
||||
BUG("non-disabled HOOK_CONFIGURED hook has no command");
|
||||
strvec_push(&cp->args, h->u.configured.command);
|
||||
} else {
|
||||
BUG("unknown hook kind");
|
||||
}
|
||||
|
||||
if (!cp->args.nr)
|
||||
|
||||
Reference in New Issue
Block a user