{"thread":{"id":"42404","subject":"[PATCH v2] pull: warn on --verify-signatures with --rebase","startedAt":"2016-05-20T21:00:54Z","lastAt":"2016-05-20T22:03:49Z","messageCount":2,"participants":["Alexander 'z33ky' Hirsch","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"287129","messageId":"20160520210054.GA1856@netblarch.fritz.box","threadId":"42404","inReplyTo":null,"subject":"[PATCH v2] pull: warn on --verify-signatures with --rebase","fromName":"Alexander 'z33ky' Hirsch","fromEmail":"1zeeky@gmail.com","sentAt":"2016-05-20T21:00:54Z","receivedAt":"2016-05-20T21:00:54Z","isPatch":true,"sender":{"key":"1zeeky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/289819?v=4"},"body":"Previously git-pull silently ignored the --verify-signatures option for\n--rebase, potentially leaving users in the believe that the rebase\noperation would check for valid GPG signatures.\n\nImplementing --verify-signatures for git-rebase was talked about, but\ndoubts for a valid workflow rose up.\nSince you usually merge other's branches into your branch you might have\nan interest that their side has a valid GPG signature.\nRebasing, on the other hand, is you building something on top of\nanother's branch, essentially giving you the power to keep things sane.\nIf a valid use case is found, where --verify-signatures for git-rebase\nlooks sensible, that feature may be added then.\n\nA warning was chosen in favor of emitting an error to prevent potential\nbreakage. A warning keeps things running, scripts for instance, while\nstill informing users about possibly unexpected behavior.\n\nSigned-off-by: Alexander 'z33ky' Hirsch <1zeeky@gmail.com>\n---\n\nThe warning message was changed to make it clear that the pull (and\nrebase) operation still proceeds.\n\nAnd the commit message was amended with more reasoning about the change\nand why alternative approaches were not used.\n\n builtin/pull.c  |  3 +++\n t/t5520-pull.sh | 16 ++++++++++++++++\n 2 files changed, 19 insertions(+)\n\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 1d7333c..b03bc39 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -815,6 +815,9 @@ static int run_rebase(const unsigned char *curr_head,\n \t\targv_array_push(&args, \"--no-autostash\");\n \telse if (opt_autostash == 1)\n \t\targv_array_push(&args, \"--autostash\");\n+\tif (opt_verify_signatures &&\n+\t\tstrcmp(opt_verify_signatures, \"--verify-signatures\") == 0)\n+\t\twarning(_(\"ignoring --verify-signatures for rebase\"));\n \n \targv_array_push(&args, \"--onto\");\n \targv_array_push(&args, sha1_to_hex(merge_head));\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 739c089..3159956 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -341,6 +341,22 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n+test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+\tgit reset --hard before-rebase &&\n+\tgit pull --rebase --verify-signatures . copy 2>err &&\n+\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\" &&\n+\ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n+'\n+\n+test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+\tgit reset --hard before-rebase &&\n+\tgit pull --rebase --no-verify-signatures . copy 2>err &&\n+\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\" &&\n+\ttest_i18ngrep ! \"verify-signatures\" err\n+'\n+\n # add a feature branch, keep-merge, that is merged into master, so the\n # test can try preserving the merge commit (or not) with various\n # --rebase flags/pull.rebase settings.\n-- \n2.8.2\n"},{"id":"287133","messageId":"xmqq7feocrp6.fsf@gitster.mtv.corp.google.com","threadId":"42404","inReplyTo":"20160520210054.GA1856@netblarch.fritz.box","subject":"Re: [PATCH v2] pull: warn on --verify-signatures with --rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-20T22:03:49Z","receivedAt":"2016-05-20T22:03:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}