From: Michael J Gruber <g...@grubix.eu>

Analogous to commit, introduce a '--no-verify' option which bypasses the
pre-merge hook. The shorthand '-n' is taken by the (non-existing)
'--no-stat' already.

[js: cleaned up trailing whitespace, moved some documentation changes
 from this commit to 2/4.]

Signed-off-by: Michael J Gruber <g...@grubix.eu>
Signed-off-by: Josh Steadmon <stead...@google.com>
---
 Documentation/githooks.txt | 2 +-
 builtin/merge.c            | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index dcc6606d44..6a93478dcf 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -108,7 +108,7 @@ pre-merge
 
 This hook is invoked by 'git merge' when doing an automatic merge
 commit; it is equivalent to 'pre-commit' for a non-automatic commit
-for a merge.
+for a merge, and can be bypassed with the `--no-verify` option.
 
 prepare-commit-msg
 ~~~~~~~~~~~~~~~~~~
diff --git a/builtin/merge.c b/builtin/merge.c
index 5bbef203f3..5ed3472c84 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -287,7 +287,7 @@ static struct option builtin_merge_options[] = {
          N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
        OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored 
files (default)")),
        OPT_BOOL(0, "signoff", &signoff, N_("add Signed-off-by:")),
-       OPT_BOOL(0, "no-verify", &no_verify, N_("bypass commit-msg hook")),
+       OPT_BOOL(0, "no-verify", &no_verify, N_("bypass pre-merge and 
commit-msg hooks")),
        OPT_END()
 };
 
@@ -818,7 +818,7 @@ static void prepare_to_commit(struct commit_list 
*remoteheads)
        struct strbuf msg = STRBUF_INIT;
        const char *index_file = get_index_file();
 
-       if (run_commit_hook(0 < option_edit, index_file, "pre-merge", NULL))
+       if (!no_verify && run_commit_hook(0 < option_edit, index_file, 
"pre-merge", NULL))
                abort_commit(remoteheads, NULL);
        /*
         * Re-read the index as pre-merge hook could have updated it,
-- 
2.22.0.657.g960e92d24f-goog

Reply via email to