Analogous to commit, introduce a '--no-verify' option which bypasses the pre-commit hook. The shorthand '-n' is taken by the (non-existing) '--no-stat' already. Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> --- Documentation/git-merge.txt | 2 +- Documentation/githooks.txt | 1 + Documentation/merge-options.txt | 4 ++++ builtin/merge.c | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 3501ae2..363fbea 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>] + [--no-verify] [-s <strategy>] [-X <strategy-option>] [--[no-]rerere-autoupdate] [-m <msg>] [<commit>...] 'git merge' <msg> HEAD <commit>... 'git merge' --abort diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index d62e02d..c734e2c 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -88,6 +88,7 @@ to modify the commit message. If the configuration option `merge.usePreCommitHook` is set to `true` then 'git merge' invokes this hook whenever it creates a new commit. +It can be bypassed with the `\--no-verify` option. prepare-commit-msg ~~~~~~~~~~~~~~~~~~ diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 0bcbe0a..5695fc6 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -70,6 +70,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-commit hook. + 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 a2590a9..58a848f 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -60,6 +60,7 @@ static const char *branch; static char *branch_mergeoptions; static int option_renormalize; static int verbosity; +static int no_verify; static int allow_rerere_auto; static int abort_current_merge; static int show_progress = -1; @@ -199,6 +200,7 @@ static struct option builtin_merge_options[] = { N_("allow fast-forward (default)")), OPT_BOOLEAN(0, "ff-only", &fast_forward_only, N_("abort if fast-forward is not possible")), + OPT_BOOLEAN(0, "no-verify", &no_verify, "bypass pre-merge hook"), OPT_RERERE_AUTOUPDATE(&allow_rerere_auto), OPT_CALLBACK('s', "strategy", &use_strategies, N_("strategy"), N_("merge strategy to use"), option_parse_strategy), @@ -904,7 +906,7 @@ static void prepare_to_commit(struct commit_list *remoteheads) const char *comment = _(merge_editor_comment); const char *index_file = get_index_file(); - if (use_pre_commit_hook && run_hook(index_file, "pre-commit", NULL)) + if (use_pre_commit_hook && !no_verify && run_hook(index_file, "pre-commit", NULL)) abort_commit(remoteheads, NULL); /* * Re-read the index as pre-commit hook could have updated it, -- 1.7.12.406.gafd3f81 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html