diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-01-16 20:07:46 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-16 20:07:46 (GMT) |
commit | b242e89dff9cc5c736bcf3629df9564a98ff23db (patch) | |
tree | 58d5c88cc3672e4648bc799ce00cb69a50b11549 /builtin/am.c | |
parent | 763f20fb4ad3108634b05f45b575d95ed13ab861 (diff) | |
parent | 566902f2db3bdad9be7fb083c713f0d21acf111e (diff) | |
download | git-b242e89dff9cc5c736bcf3629df9564a98ff23db.zip git-b242e89dff9cc5c736bcf3629df9564a98ff23db.tar.gz git-b242e89dff9cc5c736bcf3629df9564a98ff23db.tar.bz2 |
Merge branch 'tr/am--no-verify'
Conditionally skip the pre-applypatch and applypatch-msg hooks when
applying patches with 'git am'.
* tr/am--no-verify:
am: allow passing --no-verify flag
Diffstat (limited to 'builtin/am.c')
-rw-r--r-- | builtin/am.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c index dddf1b9..7e88d24 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -117,6 +117,7 @@ struct am_state { /* various operating modes and command line options */ int interactive; + int no_verify; int threeway; int quiet; int signoff; /* enum signoff_type */ @@ -472,10 +473,12 @@ static void am_destroy(const struct am_state *state) */ static int run_applypatch_msg_hook(struct am_state *state) { - int ret; + int ret = 0; assert(state->msg); - ret = run_hooks_l("applypatch-msg", am_path(state, "final-commit"), NULL); + + if (!state->no_verify) + ret = run_hooks_l("applypatch-msg", am_path(state, "final-commit"), NULL); if (!ret) { FREE_AND_NULL(state->msg); @@ -1650,7 +1653,7 @@ static void do_commit(const struct am_state *state) const char *reflog_msg, *author, *committer = NULL; struct strbuf sb = STRBUF_INIT; - if (run_hooks("pre-applypatch")) + if (!state->no_verify && run_hooks("pre-applypatch")) exit(1); if (write_cache_as_tree(&tree, 0, NULL)) @@ -2340,6 +2343,8 @@ int cmd_am(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_BOOL('i', "interactive", &state.interactive, N_("run interactively")), + OPT_BOOL('n', "no-verify", &state.no_verify, + N_("bypass pre-applypatch and applypatch-msg hooks")), OPT_HIDDEN_BOOL('b', "binary", &binary, N_("historical option -- no-op")), OPT_BOOL('3', "3way", &state.threeway, |