From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCHv2 3/4] merge: --no-verify to bypass pre-commit hook
Date: Thu, 6 Sep 2012 16:25:57 +0200 [thread overview]
Message-ID: <526ce72df2e65572cbbbc72d3f93b4a917562ead.1346939542.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <50487F8A.4050803@alum.mit.edu>
In-Reply-To: <cover.1346939542.git.git@drmicha.warpmail.net>
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@drmicha.warpmail.net>
---
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
next prev parent reply other threads:[~2012-09-06 14:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 13:39 [PATCH 0/3] pre-merge-hook Michael J Gruber
2012-09-05 13:39 ` [PATCH 1/3] git-merge: Honor pre-merge hook Michael J Gruber
2012-09-05 15:30 ` Michael Haggerty
2012-09-06 8:16 ` Michael J Gruber
2012-09-06 10:48 ` Michael Haggerty
2012-09-06 14:25 ` [PATCHv2 0/4] pre-commit hook for merges Michael J Gruber
2012-09-06 14:25 ` [PATCHv2 1/4] merge: document prepare-commit-msg hook usage Michael J Gruber
2012-09-06 14:25 ` [PATCHv2 2/4] git-merge: Honor pre-commit hook based on config Michael J Gruber
2012-09-06 14:25 ` Michael J Gruber [this message]
2012-09-06 14:25 ` [PATCHv2 4/4] t7503: add tests for pre-commit hook (merge) Michael J Gruber
2012-09-05 13:39 ` [PATCH 2/3] merge: --no-verify to bypass pre-merge hook Michael J Gruber
2012-09-05 13:39 ` [PATCH 3/3] t7503: add tests for pre-merge-hook Michael J Gruber
2012-09-06 5:07 ` [PATCH 0/3] pre-merge-hook Junio C Hamano
2012-09-06 8:16 ` Michael J Gruber
2012-09-06 18:34 ` Junio C Hamano
2012-09-07 10:00 ` Michael J Gruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=526ce72df2e65572cbbbc72d3f93b4a917562ead.1346939542.git.git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).