Git development
 help / color / mirror / Atom feed
From: Azat Khuzhin <a3at.mail@gmail.com>
To: git@vger.kernel.org
Cc: Azat Khuzhin <a3at.mail@gmail.com>
Subject: [PATCH] pull: passthrough --no-verify to merge
Date: Thu, 11 Jun 2020 20:22:01 +0300	[thread overview]
Message-ID: <20200611172201.962109-1-a3at.mail@gmail.com> (raw)

Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
---
 builtin/pull.c                                   |  6 ++++++
 t/t7503-pre-commit-and-pre-merge-commit-hooks.sh | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/builtin/pull.c b/builtin/pull.c
index 00e5857a8d..de48cab325 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -83,6 +83,7 @@ static char *opt_commit;
 static char *opt_edit;
 static char *cleanup_arg;
 static char *opt_ff;
+static char *no_verify;
 static char *opt_verify_signatures;
 static int opt_autostash = -1;
 static int config_autostash;
@@ -160,6 +161,9 @@ static struct option pull_options[] = {
 	OPT_PASSTHRU(0, "ff-only", &opt_ff, NULL,
 		N_("abort if fast-forward is not possible"),
 		PARSE_OPT_NOARG | PARSE_OPT_NONEG),
+	OPT_PASSTHRU(0, "no-verify", &no_verify, NULL,
+		N_("bypass pre-merge-commit and commit-msg hooks"),
+		PARSE_OPT_NOARG),
 	OPT_PASSTHRU(0, "verify-signatures", &opt_verify_signatures, NULL,
 		N_("verify that the named commit has a valid GPG signature"),
 		PARSE_OPT_NOARG),
@@ -691,6 +695,8 @@ static int run_merge(void)
 		argv_array_push(&args, opt_ff);
 	if (opt_verify_signatures)
 		argv_array_push(&args, opt_verify_signatures);
+	if (no_verify)
+		argv_array_push(&args, no_verify);
 	argv_array_pushv(&args, opt_strategies.argv);
 	argv_array_pushv(&args, opt_strategy_opts.argv);
 	if (opt_gpg_sign)
diff --git a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
index b3485450a2..be5dcfcc90 100755
--- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
+++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
@@ -278,4 +278,16 @@ test_expect_success 'check the author in hook' '
 	test_cmp expected_hooks actual_hooks
 '
 
+test_expect_success '--no-verify with failing hook (pull)' '
+	test_when_finished "rm -f \"$PREMERGE\" actual_hooks" &&
+	cp "$HOOKDIR/fail.sample" "$PREMERGE" &&
+	git remote add origin . &&
+	test_when_finished "git remote remove origin" &&
+	git branch -f side side-orig &&
+	git checkout side &&
+	git pull --no-verify --no-edit . master &&
+	git checkout master &&
+	test_path_is_missing actual_hooks
+'
+
 test_done
-- 
2.27.0


             reply	other threads:[~2020-06-11 17:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 17:22 Azat Khuzhin [this message]
2020-06-11 17:37 ` [PATCH] pull: passthrough --no-verify to merge Junio C Hamano

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=20200611172201.962109-1-a3at.mail@gmail.com \
    --to=a3at.mail@gmail.com \
    --cc=git@vger.kernel.org \
    /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