[PATCH 3/4] merge: --no-verify to bypass pre-merge hook

2017-09-22 Thread Michael J Gruber
From: Michael J Gruber 

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 
---
 Documentation/git-merge.txt | 2 +-
 Documentation/githooks.txt  | 2 +-
 Documentation/merge-options.txt | 4 
 builtin/merge.c | 4 ++--
 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 ] [-X ] [-S[]]
+   [--no-verify] [-s ] [-X ] [-S[]]
[--[no-]allow-unrelated-histories]
[--[no-]rerere-autoupdate] [-m ] [...]
 'git merge' --abort
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 85bedd208c..969441d7a2 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=::
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,
-- 
2.14.1.909.g0fa57a0913



Re: [PATCH 3/4] merge: --no-verify to bypass pre-merge hook

2017-09-23 Thread Junio C Hamano
Michael J Gruber  writes:

> From: Michael J Gruber 
>
> 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 
> ---

It appears that some of the pieces in this patch, namely,
D/git-merge.txt and D/merge-options.txt, belong to 2/4, where we are
fixing up an earlier addition of --[no-]verify option to the
command, to be updated to only add mention of pre-merge hook in this
step?

The end result looks good regardless, I would think, though.


Re: [PATCH 3/4] merge: --no-verify to bypass pre-merge hook

2017-09-25 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 24.09.2017 01:48:
> Michael J Gruber  writes:
> 
>> From: Michael J Gruber 
>>
>> 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 
>> ---
> 
> It appears that some of the pieces in this patch, namely,
> D/git-merge.txt and D/merge-options.txt, belong to 2/4, where we are
> fixing up an earlier addition of --[no-]verify option to the
> command, to be updated to only add mention of pre-merge hook in this
> step?

Oh, sorry, rebaser error. I should also rewrite all commits to my
current e-mail.

> The end result looks good regardless, I would think, though.

Pending restructuring and attending to the other comments...