git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pull: make --rebase --verify-signatures illegal
@ 2016-04-28  9:52 Alexander 'z33ky' Hirsch
  2016-04-28 13:44 ` [PATCH v2] " Alexander 'z33ky' Hirsch
  2016-04-28 17:12 ` [PATCH] " Stefan Beller
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander 'z33ky' Hirsch @ 2016-04-28  9:52 UTC (permalink / raw)
  To: git; +Cc: brian m. carlson, Junio C Hamano

Previously git-pull would silently ignore the --verify-signatures
option.

Signed-off-by: Alexander 'z33ky' Hirsch <1zeeky@gmail.com>
---

We had some discussion back in December about a patch that added
--verify-signatures to git-pull, that was declined.
I proposed making git-pull --rebase --verify-signatures illegal then,
although it still remained open whether to just warn or make it an
error.

In this patch I opted into making it an error, which breaks the
previously accepted git pull --rebase --verify-signatures of course,
albeit I'd argue that it probably didn't do what the user expected
anyways.
I don't know if there are compatibility concerns with this though.

 builtin/pull.c  |  2 ++
 t/t5520-pull.sh | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/builtin/pull.c b/builtin/pull.c
index d98f481..b6e1507 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -809,6 +809,8 @@ static int run_rebase(const unsigned char *curr_head,
 		argv_array_push(&args, "--no-autostash");
 	else if (opt_autostash == 1)
 		argv_array_push(&args, "--autostash");
+	if (opt_verify_signatures && strcmp(opt_verify_signatures, "--verify-signatures") == 0)
+		die(_("The --verify-signatures option does not work for --rebase."));
 
 	argv_array_push(&args, "--onto");
 	argv_array_push(&args, sha1_to_hex(merge_head));
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 739c089..cb8f741 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -341,6 +341,20 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
 	test new = "$(git show HEAD:file2)"
 '
 
+test_expect_success "pull --rebase --verify-signatures is illegal" '
+	git reset --hard before-rebase &&
+	test_must_fail git pull --rebase --verify-signatures . copy 2>err &&
+	test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" &&
+	test_i18ngrep "The --verify-signatures option does not work for --rebase." err
+'
+
+test_expect_success "pull --rebase --no-verify-signatures" '
+	git reset --hard before-rebase &&
+	git pull --rebase --no-verify-signatures . copy &&
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)"
+'
+
 # add a feature branch, keep-merge, that is merged into master, so the
 # test can try preserving the merge commit (or not) with various
 # --rebase flags/pull.rebase settings.
-- 
2.8.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-28 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28  9:52 [PATCH] pull: make --rebase --verify-signatures illegal Alexander 'z33ky' Hirsch
2016-04-28 13:44 ` [PATCH v2] " Alexander 'z33ky' Hirsch
2016-04-28 17:23   ` Junio C Hamano
2016-04-28 17:12 ` [PATCH] " Stefan Beller

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).