pull: warn on --verify-signatures with --rebase

git-pull silently ignores the --verify-signatures option when running --rebase, potentially leaving users in the belief that the rebase operation would check for valid GPG signatures. Implementing --verify-signatures for git-rebase was talked about, but doubts for a valid workflow rose up. Since you usually merge other's branches into your branch you might have an interest that their side has a valid GPG signature. Rebasing, on the other hand, is to rebuild your branch on top of other's work, in order to push the result back, and it is too late to reject their work even if you find their commits lack acceptable signature. Let's warn users that the --verify-signatures option is ignored during "pull --rebase"; users do not wonder what would happen if their commits lack acceptable signature that way. Signed-off-by: Alexander Hirsch <1zeeky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Alexander Hirsch committed May 20, 2016 at 23:00 UTC c57e501c51d6b76ce30658b94ee4a5dc6ac27f3e
2 files changed +19
builtin/pull.c
+3
@@ -815,6 +815,9 @@ static int run_rebase(const unsigned char *curr_head,
815 argv_array_push(&args, "--no-autostash");
816 else if (opt_autostash == 1)
817 argv_array_push(&args, "--autostash");
818 + if (opt_verify_signatures &&
819 + !strcmp(opt_verify_signatures, "--verify-signatures"))
820 + warning(_("ignoring --verify-signatures for rebase"));
821
822 argv_array_push(&args, "--onto");
823 argv_array_push(&args, sha1_to_hex(merge_head));
t/t5520-pull.sh
+16
@@ -341,6 +341,22 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
341 test new = "$(git show HEAD:file2)"
342 '
343
344 +test_expect_success "pull --rebase warns on --verify-signatures" '
345 + git reset --hard before-rebase &&
346 + git pull --rebase --verify-signatures . copy 2>err &&
347 + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
348 + test new = "$(git show HEAD:file2)" &&
349 + test_i18ngrep "ignoring --verify-signatures for rebase" err
350 +'
351 +
352 +test_expect_success "pull --rebase does not warn on --no-verify-signatures" '
353 + git reset --hard before-rebase &&
354 + git pull --rebase --no-verify-signatures . copy 2>err &&
355 + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
356 + test new = "$(git show HEAD:file2)" &&
357 + test_i18ngrep ! "verify-signatures" err
358 +'
359 +
360 # add a feature branch, keep-merge, that is merged into master, so the
361 # test can try preserving the merge commit (or not) with various
362 # --rebase flags/pull.rebase settings.