summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2017-09-22 14:04:14 +0200
committerJunio C Hamano <gitster@pobox.com>2017-09-24 10:43:37 +0900
commit3a658ae9f4dcde8964370afe52187a0dca50a133 (patch)
tree12d39792c634d8fc3ee86103cc7fe8e9af75ea13
parent738446503d3f3002a88ae1e8d1def232ff6e7f5d (diff)
downloadgit-3a658ae9f4dcde8964370afe52187a0dca50a133.tar.gz
merge: --no-verify to bypass pre-merge hook
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. Signed-off-by: Michael J Gruber <git@grubix.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Documentation/git-merge.txt2
-rw-r--r--Documentation/githooks.txt2
-rw-r--r--Documentation/merge-options.txt4
-rw-r--r--builtin/merge.c4
4 files changed, 8 insertions, 4 deletions
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 4df6431c34..5f0e1768e1 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
- [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
+ [--no-verify] [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
[--[no-]allow-unrelated-histories]
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
'git merge' --abort
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 85bedd208c..d4a24596ce 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -104,7 +104,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/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 4e32304301..75019d5919 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -74,6 +74,10 @@ merge.
With --no-squash perform the merge and commit the result. This
option can be used to override --squash.
+--no-verify::
+ This option bypasses the pre-merge and commit-msg hooks.
+ See also linkgit:githooks[5].
+
-s <strategy>::
--strategy=<strategy>::
Use the given merge strategy; can be supplied more than
diff --git a/builtin/merge.c b/builtin/merge.c
index 7ba094ee87..c63510c199 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -237,7 +237,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()
};
@@ -771,7 +771,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,