{"thread":{"id":"53136","subject":"Support for `--no-gpg-sign` in git rebase, cherry-pick, etc","startedAt":"2020-03-30T20:04:03Z","lastAt":"2020-04-04T14:36:51Z","messageCount":24,"participants":["Dominic Chen","Danh Doan","Junio C Hamano","Đoàn Trần Công Danh","Martin Ågren","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"394393","messageId":"81aea443-6978-93d7-c5d3-98dd731a1fd8@gmail.com","threadId":"53136","inReplyTo":null,"subject":"Support for `--no-gpg-sign` in git rebase, cherry-pick, etc","fromName":"Dominic Chen","fromEmail":"d.c.ddcc@gmail.com","sentAt":"2020-03-30T20:03:55Z","receivedAt":"2020-03-30T20:04:03Z","isPatch":false,"sender":{"key":"d.c.ddcc@gmail.com","avatar":null},"body":"Hello,\n\nThe subcommand `git commit` supports a `--no-gpg-sign` argument, which I\nfind useful for cases where e.g. a GPG key is specified in `.gitconfig`,\nbut is located on a hardware key that may not currently be attached to\nthe system. However, other commands like `git rebase`, `git\ncherry-pick`, etc, which internally invoke `git commit`, don't support\nthis argument at all, making things more cumbersome. It'd be great if\nthese other commands could also support this argument, and propagate it\ninternally when calling `git commit`.\n\nThanks,\n\nDominic\n\n"},{"id":"394405","messageId":"20200331064456.GA15850@danh.dev","threadId":"53136","inReplyTo":"81aea443-6978-93d7-c5d3-98dd731a1fd8@gmail.com","subject":"[PATCH] rebase.c: teach --no-gpg-sign to git-rebase","fromName":"Danh Doan","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-03-31T06:44:56Z","receivedAt":"2020-03-31T06:45:04Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2020-03-30 16:03:55-0400, Dominic Chen <d.c.ddcc@gmail.com> wrote:\n> The subcommand `git commit` supports a `--no-gpg-sign` argument, which I\n> find useful for cases where e.g. a GPG key is specified in `.gitconfig`,\n> but is located on a hardware key that may not currently be attached to\n> the system. However, other commands like `git rebase`, `git\n> cherry-pick`, etc, which internally invoke `git commit`, don't support\n\ncherry-pick (in git 2.25.1) understands --no-gpg-sign\n\nI've encountered this in the past, but I stopped signing my commit.\n\nAnyways, here is the patch\n\n-----------------8<-----------------\nFrom: Đoàn Trần Công Danh <congdanhqx@gmail.com>\nSubject: [PATCH] rebase.c: teach --no-gpg-sign to git-rebase\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-rebase.txt |  5 +++\n builtin/rebase.c             | 10 +++--\n t/t3435-rebase-gpg-sign.sh   | 72 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 84 insertions(+), 3 deletions(-)\n create mode 100755 t/t3435-rebase-gpg-sign.sh\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex f7a6033607..54023cf3bb 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -358,6 +358,11 @@ See also INCOMPATIBLE OPTIONS below.\n \tdefaults to the committer identity; if specified, it must be\n \tstuck to the option without a space.\n \n+--no-gpg-sign::\n+\tCountermand `commit.gpgSign` configuration variable that is\n+\tset to force each and every commit to be signed.\n+\n+\n -q::\n --quiet::\n \tBe quiet. Implies --no-stat.\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 27a07d4e78..a8cc5cfe0c 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1593,6 +1593,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \n \toptions.allow_empty_message = 1;\n \tgit_config(rebase_config, &options);\n+\t// options.gpg_sign_opt will be either \"-S\" or NULL\n+\t// It'll be freed later, hence, no skip-prefix\n+\tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n \n \tif (options.use_legacy_rebase ||\n \t    !git_env_bool(\"GIT_TEST_REBASE_USE_BUILTIN\", -1))\n@@ -1823,10 +1826,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \tif (options.empty != EMPTY_UNSPECIFIED)\n \t\timply_merge(&options, \"--empty\");\n \n-\tif (gpg_sign) {\n-\t\tfree(options.gpg_sign_opt);\n+\tfree(options.gpg_sign_opt);\n+\tif (gpg_sign)\n \t\toptions.gpg_sign_opt = xstrfmt(\"-S%s\", gpg_sign);\n-\t}\n+\telse\n+\t\toptions.gpg_sign_opt = NULL;\n \n \tif (exec.nr) {\n \t\tint i;\ndiff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh\nnew file mode 100755\nindex 0000000000..d12b30b033\n--- /dev/null\n+++ b/t/t3435-rebase-gpg-sign.sh\n@@ -0,0 +1,72 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2020 Doan Tran Cong Danh\n+#\n+\n+test_description='test rebase --[no-]gpg-sign'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n+\n+if ! test_have_prereq GPG\n+then\n+\tskip_all='skip all test rebase --[no-]gpg-sign, gpg not available'\n+\ttest_done\n+fi\n+\n+test_expect_success 'setup: not-signed commit' '\n+\ttest_commit one &&\n+\ttest_commit two &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^ &&\n+\tgit tag unsigned\n+'\n+\n+test_expect_success 'setup: rebase --gpg-sign to sign all commit' '\n+\tgit rebase --gpg-sign --force-rebase --root &&\n+\tgit verify-commit HEAD &&\n+\tgit verify-commit HEAD^ &&\n+\tgit tag signed\n+'\n+\n+test_expect_success 'rebase without commit.gpgsign config' '\n+\tgit reset --hard signed &&\n+\ttest_might_fail git config --unset commit.gpgsign &&\n+\tgit rebase --force-rebase --root &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_expect_success 'rebase respects commit.gpgsign=true config' '\n+\tgit reset --hard unsigned &&\n+\tgit config commit.gpgsign true &&\n+\tgit rebase --force-rebase --root &&\n+\tgit verify-commit HEAD &&\n+\tgit verify-commit HEAD^\n+'\n+\n+test_expect_success 'rebase --no-gpg-sign overrides commit.gpgsign' '\n+\tgit reset --hard unsigned &&\n+\tgit config commit.gpgsign true &&\n+\tgit rebase --no-gpg-sign --force-rebase --root &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_expect_success 'rebase --no-gpg-sign clear signed commit' '\n+\tgit reset --hard signed &&\n+\tgit config commit.gpgsign true &&\n+\tgit rebase --no-gpg-sign --force-rebase --root &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_expect_success 'rebase -i --no-gpg-sign override commit.gpgsign' '\n+\tgit reset --hard signed &&\n+\tgit config commit.gpgsign true &&\n+\tGIT_EDITOR=true git rebase -i --no-gpg-sign --force-rebase --root &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_done\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394506","messageId":"xmqqv9mj5c9o.fsf@gitster.c.googlers.com","threadId":"53136","inReplyTo":"20200331064456.GA15850@danh.dev","subject":"Re: [PATCH] rebase.c: teach --no-gpg-sign to git-rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-01T17:47:15Z","receivedAt":"2020-04-01T17:47:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Danh Doan <congdanhqx@gmail.com> writes:\n\n> From: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> Subject: [PATCH] rebase.c: teach --no-gpg-sign to git-rebase\n>\n> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> ---\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index f7a6033607..54023cf3bb 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -358,6 +358,11 @@ See also INCOMPATIBLE OPTIONS below.\n>  \tdefaults to the committer identity; if specified, it must be\n>  \tstuck to the option without a space.\n>  \n> +--no-gpg-sign::\n> +\tCountermand `commit.gpgSign` configuration variable that is\n> +\tset to force each and every commit to be signed.\n> +\n> +\n\nTwo points.  \n\n - There must be already an entry for '--gpg-sign'.  It would make\n   more sense to make this addtion a part of its description.\n\n - The --no-<option> form is not just to override a configured\n   default, but also to coumtermand an option given earlier on the\n   command line.  In other words \"rebase -S --no-gpg-sign\" without\n   any commit.gpgSign should work just fine.\n\n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 27a07d4e78..a8cc5cfe0c 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -1593,6 +1593,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>  \n>  \toptions.allow_empty_message = 1;\n>  \tgit_config(rebase_config, &options);\n> +\t// options.gpg_sign_opt will be either \"-S\" or NULL\n> +\t// It'll be freed later, hence, no skip-prefix\n\nDon't use //- comments.\n\n> +\tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n\nWe've read configured commit.gpgSign in options.gpg_sign_opt; it is\neither a freeable \"-S\" or NULL depending on its value.  We initialize\nthe local gpg_sign variable to either an unfreeable \"\" or NULL here.\n\nLet's see how that local variable is later used here.  We know it is\ngiven as the target variable to OPTION_STRING, which will overwrite\nwith the value given from the command line, so \"\" that is unfreeable\navoids an unnecessary leak.\n\n - If we did not have --gpg-sign, or --no-gpg-sign, then the local\n   variable gpg_sign will stay to be either \"\" or NULL after\n   parse_options() returns.\n\n - If we had --gpg-sign or --no-gpg-sign, we will have the value\n   given from the last one of them on the command line in gpg_sign\n   after parse_options() returns.\n\n\n\n> @@ -1823,10 +1826,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>  \tif (options.empty != EMPTY_UNSPECIFIED)\n>  \t\timply_merge(&options, \"--empty\");\n>  \n> -\tif (gpg_sign) {\n> -\t\tfree(options.gpg_sign_opt);\n> +\tfree(options.gpg_sign_opt);\n> +\tif (gpg_sign)\n>  \t\toptions.gpg_sign_opt = xstrfmt(\"-S%s\", gpg_sign);\n> -\t}\n> +\telse\n> +\t\toptions.gpg_sign_opt = NULL;\n\nNow we _always_ override options.gpg_sign_opt based on the value in\nthe local gpg_sign variable, so the *ONLY* time options.gpg_sign_opt\nis used is immediately after git_config() returns to decide what\nvalue to assign to gpg_sign we saw above.  I *think* it would be\nmuch clearer to FREE_AND_NULL options.gpg_sign_out immediately after\nwe initialize gpg_sign above, instead of freeing it here.\n\nThen you do not need the elese clause here, either.\n\nThis is a total tangent, but do we ever call cmd_rebase__interactive()\nthese days?  It does not seem to do the config thing, and assigns the\nstring taken from the command line to opts.gpg_sign_opt, which means\nthat it is an error to free the field in any codepath that can be\nreached from there.\n\nI suspect that after removing \"rebase --preserve-merges\", there is\nnobody that calls \"git rebase--interactive\", and at that point the\nfunction will be dead-code and can safely be removed.\n\nThanks.\n"},{"id":"394538","messageId":"20200402010952.GB2764@danh.dev","threadId":"53136","inReplyTo":"xmqqv9mj5c9o.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] rebase.c: teach --no-gpg-sign to git-rebase","fromName":"Danh Doan","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T01:09:52Z","receivedAt":"2020-04-02T01:09:58Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2020-04-01 10:47:15-0700, Junio C Hamano <gitster@pobox.com> wrote:\n> Two points.  \n> \n>  - There must be already an entry for '--gpg-sign'.  It would make\n>    more sense to make this addtion a part of its description.\n> \n>  - The --no-<option> form is not just to override a configured\n>    default, but also to coumtermand an option given earlier on the\n>    command line.  In other words \"rebase -S --no-gpg-sign\" without\n>    any commit.gpgSign should work just fine.\n\nThat paragraph was copy-pasted from git-commit documentation.\nI think it would need a clean up there, too.\n\nAnd, mention of --no-gpg-sign in am, cherry-pick, revert,\nmerge-option.\n\nWhile writing this, I've checked (again) all commands mentioned\n--gpg-sign. To my surprise, \"revert\" (despite shares most of code with\n\"cherry-pick\") doesn't honour --no-gpg-sign, either.\n\nI'll teach \"--no-gpg-sign\" too revert and update all documentation for\nthis.\n\n> > diff --git a/builtin/rebase.c b/builtin/rebase.c\n> > index 27a07d4e78..a8cc5cfe0c 100644\n> > --- a/builtin/rebase.c\n> > +++ b/builtin/rebase.c\n> > @@ -1593,6 +1593,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n> >  \n> >  \toptions.allow_empty_message = 1;\n> >  \tgit_config(rebase_config, &options);\n> > +\t// options.gpg_sign_opt will be either \"-S\" or NULL\n> > +\t// It'll be freed later, hence, no skip-prefix\n> \n> Don't use //- comments.\n>\n> > +\tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n> \n> We've read configured commit.gpgSign in options.gpg_sign_opt; it is\n> either a freeable \"-S\" or NULL depending on its value.  We initialize\n> the local gpg_sign variable to either an unfreeable \"\" or NULL here.\n> \n> Let's see how that local variable is later used here.  We know it is\n> given as the target variable to OPTION_STRING, which will overwrite\n> with the value given from the command line, so \"\" that is unfreeable\n> avoids an unnecessary leak.\n> \n>  - If we did not have --gpg-sign, or --no-gpg-sign, then the local\n>    variable gpg_sign will stay to be either \"\" or NULL after\n>    parse_options() returns.\n> \n>  - If we had --gpg-sign or --no-gpg-sign, we will have the value\n>    given from the last one of them on the command line in gpg_sign\n>    after parse_options() returns.\n> \n> \n> \n> > @@ -1823,10 +1826,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n> >  \tif (options.empty != EMPTY_UNSPECIFIED)\n> >  \t\timply_merge(&options, \"--empty\");\n> >  \n> > -\tif (gpg_sign) {\n> > -\t\tfree(options.gpg_sign_opt);\n> > +\tfree(options.gpg_sign_opt);\n> > +\tif (gpg_sign)\n> >  \t\toptions.gpg_sign_opt = xstrfmt(\"-S%s\", gpg_sign);\n> > -\t}\n> > +\telse\n> > +\t\toptions.gpg_sign_opt = NULL;\n> \n> Now we _always_ override options.gpg_sign_opt based on the value in\n> the local gpg_sign variable, so the *ONLY* time options.gpg_sign_opt\n> is used is immediately after git_config() returns to decide what\n> value to assign to gpg_sign we saw above.  I *think* it would be\n> much clearer to FREE_AND_NULL options.gpg_sign_out immediately after\n> we initialize gpg_sign above, instead of freeing it here.\n\nMake sense,\n\n> Then you do not need the elese clause here, either.\n> \n> This is a total tangent, but do we ever call cmd_rebase__interactive()\n> these days?  It does not seem to do the config thing, and assigns the\n> string taken from the command line to opts.gpg_sign_opt, which means\n> that it is an error to free the field in any codepath that can be\n> reached from there.\n\ncmd_rebase__interactive go through different code path, and it doesn't\nrun into above line\n\n> I suspect that after removing \"rebase --preserve-merges\", there is\n> nobody that calls \"git rebase--interactive\", and at that point the\n> function will be dead-code and can safely be removed.\n\nI've grep-ed the code and it's look like only \"rebase -p\" call\ncmd_rebase__interactive,\n\nI've drafted a test, and \"rebase -p\" indeeds doesn't honour\n\"--no-gpg-sign\",\n\nConsider the deprecation of \"--preserve-merges\" is more than a year,\nI think I'll mark that test as broken instead of trying to fix it.\n\n-- \nDanh\n"},{"id":"394558","messageId":"cover.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"20200331064456.GA15850@danh.dev","subject":"[PATCH v2 0/5] Honour and Document --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:29Z","receivedAt":"2020-04-02T10:15:49Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"The subcommand `git commit` supports a `--no-gpg-sign` argument, which is\nuseful incases where e.g. a GPG key is specified in `.gitconfig`,\nbut is located on a hardware key that may not currently be attached to\nthe system.\n\nMultiple commands that understand --gpg-sign but haven't understand\n--no-gpg-sign, yet.\n\nAlso, document more commands that honours --no-gpg-sign\n\nChange since v1:\n- FREE_AND_NULL as soon as possible\n- update test code for rebase --no-gpg-sign\n- revert (--edit which is default in tty) now honours --no-gpg-sign\n- cherry-pick --edit now honours --no-gpg-sign\n- add more documentation\n\nĐoàn Trần Công Danh (5):\n  rebase.c: honour --no-gpg-sign\n  cherry-pick/revert: honour --no-gpg-sign in all case\n  Documentation: document am --no-gpg-sign\n  Documentation: reword commit --no-gpg-sign\n  Documentation: document merge option --no-gpg-sign\n\n Documentation/git-am.txt          |  4 +-\n Documentation/git-cherry-pick.txt |  5 +-\n Documentation/git-commit.txt      |  8 ++-\n Documentation/git-rebase.txt      |  5 +-\n Documentation/git-revert.txt      |  5 +-\n Documentation/merge-options.txt   |  5 +-\n builtin/rebase.c                  |  7 +--\n sequencer.c                       |  2 +\n t/t3435-rebase-gpg-sign.sh        | 71 +++++++++++++++++++++++++\n t/t3514-cherry-pick-revert-gpg.sh | 86 +++++++++++++++++++++++++++++++\n 10 files changed, 185 insertions(+), 13 deletions(-)\n create mode 100755 t/t3435-rebase-gpg-sign.sh\n create mode 100755 t/t3514-cherry-pick-revert-gpg.sh\n\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394559","messageId":"9975d4c61301f865dbd6aa3e1f70c6b5cc64daf0.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585821581.git.congdanhqx@gmail.com","subject":"[PATCH v2 1/5] rebase.c: honour --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:30Z","receivedAt":"2020-04-02T10:15:50Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-rebase.txt |  5 ++-\n builtin/rebase.c             |  7 ++--\n t/t3435-rebase-gpg-sign.sh   | 71 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 79 insertions(+), 4 deletions(-)\n create mode 100755 t/t3435-rebase-gpg-sign.sh\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex f7a6033607..3b94c134fe 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -354,9 +354,12 @@ See also INCOMPATIBLE OPTIONS below.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier \"--gpg-sign\".\n \n -q::\n --quiet::\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 27a07d4e78..7e2ad66e9e 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1593,6 +1593,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \n \toptions.allow_empty_message = 1;\n \tgit_config(rebase_config, &options);\n+\t/* options.gpg_sign_opt will be either \"-S\" or NULL */\n+\tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n+\tFREE_AND_NULL(options.gpg_sign_opt);\n \n \tif (options.use_legacy_rebase ||\n \t    !git_env_bool(\"GIT_TEST_REBASE_USE_BUILTIN\", -1))\n@@ -1823,10 +1826,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \tif (options.empty != EMPTY_UNSPECIFIED)\n \t\timply_merge(&options, \"--empty\");\n \n-\tif (gpg_sign) {\n-\t\tfree(options.gpg_sign_opt);\n+\tif (gpg_sign)\n \t\toptions.gpg_sign_opt = xstrfmt(\"-S%s\", gpg_sign);\n-\t}\n \n \tif (exec.nr) {\n \t\tint i;\ndiff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh\nnew file mode 100755\nindex 0000000000..b47c59c190\n--- /dev/null\n+++ b/t/t3435-rebase-gpg-sign.sh\n@@ -0,0 +1,71 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2020 Doan Tran Cong Danh\n+#\n+\n+test_description='test rebase --[no-]gpg-sign'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-rebase.sh\"\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n+\n+if ! test_have_prereq GPG\n+then\n+\tskip_all='skip all test rebase --[no-]gpg-sign, gpg not available'\n+\ttest_done\n+fi\n+\n+test_rebase_gpg_sign () {\n+\tlocal must_fail= will=will fake_editor=\n+\tif test \"x$1\" = \"x!\"\n+\tthen\n+\t\tmust_fail=test_must_fail\n+\t\twill=\"won't\"\n+\t\tshift\n+\tfi\n+\tconf=$1\n+\tshift\n+\ttest_expect_success \"rebase $* with commit.gpgsign=$conf $will sign commit\" \"\n+\t\tgit reset two &&\n+\t\tgit config commit.gpgsign $conf &&\n+\t\tset_fake_editor &&\n+\t\tFAKE_LINES='r 1 p 2' git rebase --force-rebase --root $* &&\n+\t\t$must_fail git verify-commit HEAD^ &&\n+\t\t$must_fail git verify-commit HEAD\n+\t\"\n+}\n+\n+test_expect_success 'setup' '\n+\ttest_commit one &&\n+\ttest_commit two &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_expect_success 'setup: merge commit' '\n+\ttest_commit fork-point &&\n+\tgit switch -c side &&\n+\ttest_commit three &&\n+\tgit switch master &&\n+\tgit merge --no-ff side &&\n+\tgit tag merged\n+'\n+\n+test_rebase_gpg_sign ! false\n+test_rebase_gpg_sign   true\n+test_rebase_gpg_sign ! true  --no-gpg-sign\n+test_rebase_gpg_sign ! true  --gpg-sign --no-gpg-sign\n+test_rebase_gpg_sign   false --no-gpg-sign --gpg-sign\n+test_rebase_gpg_sign   true  -i\n+test_rebase_gpg_sign ! true  -i --no-gpg-sign\n+test_rebase_gpg_sign ! true  -i --gpg-sign --no-gpg-sign\n+test_rebase_gpg_sign   false -i --no-gpg-sign --gpg-sign\n+\n+test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '\n+\tgit reset --hard merged &&\n+\tgit config commit.gpgsign true &&\n+\tgit rebase -p --no-gpg-sign --onto=one fork-point master &&\n+\ttest_must_fail git verify-commit HEAD\n+'\n+\n+test_done\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394560","messageId":"09af4cda24185bdc536dc04183bacf5d43dd5d05.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585821581.git.congdanhqx@gmail.com","subject":"[PATCH v2 3/5] Documentation: document am --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:32Z","receivedAt":"2020-04-02T10:15:53Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-am.txt | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex ab5754e05d..05a2c1b887 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -150,7 +150,9 @@ default.   You can use `--no-utf8` to override this.\n --gpg-sign[=<keyid>]::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier \"--gpg-sign\".\n \n --continue::\n -r::\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394561","messageId":"c15f9d54cb9f25f9d8a7721882bf8c93de4a12a2.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585821581.git.congdanhqx@gmail.com","subject":"[PATCH v2 4/5] Documentation: reword commit --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:33Z","receivedAt":"2020-04-02T10:15:55Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Merge with --gpg-sign option, and clarify that --no-gpg-sign also\noverride earlier --gpg-sign.\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-commit.txt | 8 +++-----\n 1 file changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 13f653989f..6f6c06028b 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -350,11 +350,9 @@ changes to tracked files.\n --gpg-sign[=<keyid>]::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n-\n---no-gpg-sign::\n-\tCountermand `commit.gpgSign` configuration variable that is\n-\tset to force each and every commit to be signed.\n+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier \"--gpg-sign\".\n \n \\--::\n \tDo not interpret any more arguments as options.\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394562","messageId":"9516562b0025d23dc8642bdaa4a4f7f2a1ff4933.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585821581.git.congdanhqx@gmail.com","subject":"[PATCH v2 2/5] cherry-pick/revert: honour --no-gpg-sign in all case","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:31Z","receivedAt":"2020-04-02T10:15:55Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"{cherry-pick,revert} --edit hasn't honoured --no-gpg-sign yet.\n\nPass this option down to git-commit to honour it.\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-cherry-pick.txt |  5 +-\n Documentation/git-revert.txt      |  5 +-\n sequencer.c                       |  2 +\n t/t3514-cherry-pick-revert-gpg.sh | 86 +++++++++++++++++++++++++++++++\n 4 files changed, 96 insertions(+), 2 deletions(-)\n create mode 100755 t/t3514-cherry-pick-revert-gpg.sh\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex 83ce51aedf..89d7a7920a 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -109,9 +109,12 @@ effect to your index in a row.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier \"--gpg-sign\".\n \n --ff::\n \tIf the current HEAD is the same as the parent of the\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 9d22270757..7e7f39517b 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -90,9 +90,12 @@ effect to your index in a row.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier \"--gpg-sign\".\n \n -s::\n --signoff::\ndiff --git a/sequencer.c b/sequencer.c\nindex 6fd2674632..9969355de7 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -946,6 +946,8 @@ static int run_git_commit(struct repository *r,\n \t\targv_array_push(&cmd.args, \"--amend\");\n \tif (opts->gpg_sign)\n \t\targv_array_pushf(&cmd.args, \"-S%s\", opts->gpg_sign);\n+\telse\n+\t\targv_array_push(&cmd.args, \"--no-gpg-sign\");\n \tif (defmsg)\n \t\targv_array_pushl(&cmd.args, \"-F\", defmsg, NULL);\n \telse if (!(flags & EDIT_MSG))\ndiff --git a/t/t3514-cherry-pick-revert-gpg.sh b/t/t3514-cherry-pick-revert-gpg.sh\nnew file mode 100755\nindex 0000000000..5b2e250eaa\n--- /dev/null\n+++ b/t/t3514-cherry-pick-revert-gpg.sh\n@@ -0,0 +1,86 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2020 Doan Tran Cong Danh\n+#\n+\n+test_description='test {cherry-pick,revert} --[no-]gpg-sign'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n+\n+if ! test_have_prereq GPG\n+then\n+\tskip_all='skip all test {cherry-pick,revert} --[no-]gpg-sign, gpg not available'\n+\ttest_done\n+fi\n+\n+test_gpg_sign () {\n+\tlocal must_fail= will=will fake_editor=\n+\tif test \"x$1\" = \"x!\"\n+\tthen\n+\t\tmust_fail=test_must_fail\n+\t\twill=\"won't\"\n+\t\tshift\n+\tfi\n+\tconf=$1\n+\tcmd=$2\n+\tcmit=$3\n+\tshift 3\n+\ttest_expect_success \"$cmd $* $cmit with commit.gpgsign=$conf $will sign commit\" \"\n+\t\tgit reset --hard tip &&\n+\t\tgit config commit.gpgsign $conf &&\n+\t\tgit $cmd $* $cmit &&\n+\t\tgit rev-list tip.. >rev-list &&\n+\t\t$must_fail git verify-commit \\$(cat rev-list)\n+\t\"\n+}\n+\n+test_expect_success 'setup' '\n+\ttest_commit one &&\n+\tgit switch -c side &&\n+\ttest_commit side1 &&\n+\ttest_commit side2 &&\n+\tgit switch - &&\n+\ttest_commit two &&\n+\ttest_commit three &&\n+\ttest_commit tip\n+'\n+\n+test_gpg_sign ! false cherry-pick   side\n+test_gpg_sign ! false cherry-pick ..side\n+test_gpg_sign   true  cherry-pick   side\n+test_gpg_sign   true  cherry-pick ..side\n+test_gpg_sign ! true  cherry-pick   side --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick   side --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --gpg-sign --no-gpg-sign\n+test_gpg_sign   false cherry-pick   side --no-gpg-sign --gpg-sign\n+test_gpg_sign   false cherry-pick ..side --no-gpg-sign --gpg-sign\n+test_gpg_sign   true  cherry-pick   side --edit\n+test_gpg_sign   true  cherry-pick ..side --edit\n+test_gpg_sign ! true  cherry-pick   side --edit --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --edit --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick   side --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false cherry-pick   side --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   false cherry-pick ..side --edit --no-gpg-sign --gpg-sign\n+\n+test_gpg_sign ! false revert HEAD  --edit\n+test_gpg_sign ! false revert two.. --edit\n+test_gpg_sign   true  revert HEAD  --edit\n+test_gpg_sign   true  revert two.. --edit\n+test_gpg_sign ! true  revert HEAD  --edit --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --edit --no-gpg-sign\n+test_gpg_sign ! true  revert HEAD  --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false revert HEAD  --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   false revert two.. --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   true  revert HEAD  --no-edit\n+test_gpg_sign   true  revert two.. --no-edit\n+test_gpg_sign ! true  revert HEAD  --no-edit --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --no-edit --no-gpg-sign\n+test_gpg_sign ! true  revert HEAD  --no-edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --no-edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false revert HEAD  --no-edit --no-gpg-sign --gpg-sign\n+\n+test_done\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394563","messageId":"d35dd89c52e427861c38d17e43c61fca149dbfd5.1585821581.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585821581.git.congdanhqx@gmail.com","subject":"[PATCH v2 5/5] Documentation: document merge option --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-02T10:15:34Z","receivedAt":"2020-04-02T10:15:58Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/merge-options.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt\nindex 40dc4f5e8c..c46e4fe598 100644\n--- a/Documentation/merge-options.txt\n+++ b/Documentation/merge-options.txt\n@@ -61,9 +61,12 @@ When not possible, refuse to merge and exit with a non-zero status.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign the resulting merge commit. The `keyid` argument is\n \toptional and defaults to the committer identity; if specified,\n-\tit must be stuck to the option without a space.\n+\tit must be stuck to the option without a space. \"--no-gpg-sign\"\n+\tis useful to countermand both `commit.gpgSign` configuration variable,\n+\tand earlier \"--gpg-sign\".\n \n --log[=<n>]::\n --no-log::\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394615","messageId":"xmqqo8s93go8.fsf@gitster.c.googlers.com","threadId":"53136","inReplyTo":"d35dd89c52e427861c38d17e43c61fca149dbfd5.1585821581.git.congdanhqx@gmail.com","subject":"Re: [PATCH v2 5/5] Documentation: document merge option --no-gpg-sign","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-02T18:07:19Z","receivedAt":"2020-04-02T18:07:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:\n\n> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> ---\n>  Documentation/merge-options.txt | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt\n> index 40dc4f5e8c..c46e4fe598 100644\n> --- a/Documentation/merge-options.txt\n> +++ b/Documentation/merge-options.txt\n> @@ -61,9 +61,12 @@ When not possible, refuse to merge and exit with a non-zero status.\n>  \n>  -S[<keyid>]::\n>  --gpg-sign[=<keyid>]::\n> +--no-gpg-sign::\n>  \tGPG-sign the resulting merge commit. The `keyid` argument is\n>  \toptional and defaults to the committer identity; if specified,\n> -\tit must be stuck to the option without a space.\n> +\tit must be stuck to the option without a space. \"--no-gpg-sign\"\n> +\tis useful to countermand both `commit.gpgSign` configuration variable,\n> +\tand earlier \"--gpg-sign\".\n\nShouldn't [4/5] also add '--no-gpg-sign' to the header like the\nabove?\n\nOther than that, all patches were pleasant read.\nThanks.\n"},{"id":"394635","messageId":"20200403002528.GB29543@danh.dev","threadId":"53136","inReplyTo":"xmqqo8s93go8.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2 5/5] Documentation: document merge option --no-gpg-sign","fromName":"Danh Doan","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T00:25:28Z","receivedAt":"2020-04-03T00:25:33Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2020-04-02 11:07:19-0700, Junio C Hamano <gitster@pobox.com> wrote:\n> Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:\n> \n> > Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> > ---\n> >  Documentation/merge-options.txt | 5 ++++-\n> >  1 file changed, 4 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt\n> > index 40dc4f5e8c..c46e4fe598 100644\n> > --- a/Documentation/merge-options.txt\n> > +++ b/Documentation/merge-options.txt\n> > @@ -61,9 +61,12 @@ When not possible, refuse to merge and exit with a non-zero status.\n> >  \n> >  -S[<keyid>]::\n> >  --gpg-sign[=<keyid>]::\n> > +--no-gpg-sign::\n> >  \tGPG-sign the resulting merge commit. The `keyid` argument is\n> >  \toptional and defaults to the committer identity; if specified,\n> > -\tit must be stuck to the option without a space.\n> > +\tit must be stuck to the option without a space. \"--no-gpg-sign\"\n> > +\tis useful to countermand both `commit.gpgSign` configuration variable,\n> > +\tand earlier \"--gpg-sign\".\n> \n> Shouldn't [4/5] also add '--no-gpg-sign' to the header like the\n> above?\n\nYes, my bad. Since it's very small change.\nCould you please help me do it instead.\n\n-- \nDanh\n"},{"id":"394641","messageId":"CAN0heSob_O4hNj8-9eLc3Qq-Cj-SzWyOkdQh8zG0bqSFTvpwoA@mail.gmail.com","threadId":"53136","inReplyTo":"9975d4c61301f865dbd6aa3e1f70c6b5cc64daf0.1585821581.git.congdanhqx@gmail.com","subject":"Re: [PATCH v2 1/5] rebase.c: honour --no-gpg-sign","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-04-03T05:21:58Z","receivedAt":"2020-04-03T05:20:05Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"Hi Danh,\n\nOn Thu, 2 Apr 2020 at 12:17, Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:\n>\n>  -S[<keyid>]::\n>  --gpg-sign[=<keyid>]::\n> +--no-gpg-sign::\n>         GPG-sign commits. The `keyid` argument is optional and\n>         defaults to the committer identity; if specified, it must be\n> -       stuck to the option without a space.\n> +       stuck to the option without a space. \"--no-gpg-sign\" is useful to\n> +       countermand both `commit.gpgSign` configuration variable, and\n> +       earlier \"--gpg-sign\".\n\nPlease use `backticks`: `--no-gpg-sign` and `--gpg-sign` just like you\ndo with `commit.gpgSign`. It will then end up typeset in monospace. This\ncomment applies to all five patches.\n\nThanks for working on this.\n\nMartin\n"},{"id":"394648","messageId":"cover.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"20200331064456.GA15850@danh.dev","subject":"[PATCH v3 0/6] Honour and Document --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:01Z","receivedAt":"2020-04-03T10:28:35Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"The subcommand `git commit` supports a `--no-gpg-sign` argument, which is\nuseful incases where e.g. a GPG key is specified in `.gitconfig`,\nbut is located on a hardware key that may not currently be attached to\nthe system.\n\nMultiple commands that understand --gpg-sign but haven't understand\n--no-gpg-sign, yet.\n\nAlso, document more commands that honours --no-gpg-sign\n\nChange in v3 since v2:\n- Use `backticks` instead of \"dquote\" for options\n- Add missing \"--no-gpg-sign::\"\n- Merge git-commit-tree --[no-]gpg-sign\"\n\nChange in v2 since v1:\n- FREE_AND_NULL as soon as possible\n- update test code for rebase --no-gpg-sign\n- revert (--edit which is default in tty) now honours --no-gpg-sign\n- cherry-pick --edit now honours --no-gpg-sign\n- add more documentation\n\nĐoàn Trần Công Danh (6):\n  rebase.c: honour --no-gpg-sign\n  cherry-pick/revert: honour --no-gpg-sign in all case\n  Documentation: document am --no-gpg-sign\n  Documentation: reword commit --no-gpg-sign\n  Documentation: merge commit-tree --[no-]gpg-sign\n  Documentation: document merge option --no-gpg-sign\n\n Documentation/git-am.txt          |  5 +-\n Documentation/git-cherry-pick.txt |  5 +-\n Documentation/git-commit-tree.txt |  8 ++-\n Documentation/git-commit.txt      |  9 ++--\n Documentation/git-rebase.txt      |  5 +-\n Documentation/git-revert.txt      |  5 +-\n Documentation/merge-options.txt   |  5 +-\n builtin/rebase.c                  |  7 +--\n sequencer.c                       |  2 +\n t/t3435-rebase-gpg-sign.sh        | 71 +++++++++++++++++++++++++\n t/t3514-cherry-pick-revert-gpg.sh | 86 +++++++++++++++++++++++++++++++\n 11 files changed, 190 insertions(+), 18 deletions(-)\n create mode 100755 t/t3435-rebase-gpg-sign.sh\n create mode 100755 t/t3514-cherry-pick-revert-gpg.sh\n\nRange-diff against v2:\n1:  b886c69e92 ! 1:  b601c99f7b rebase.c: honour --no-gpg-sign\n    @@ Metadata\n      ## Commit message ##\n         rebase.c: honour --no-gpg-sign\n     \n    -    Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n    -\n      ## Documentation/git-rebase.txt ##\n     @@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.\n      \n    @@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.\n      \tGPG-sign commits. The `keyid` argument is optional and\n      \tdefaults to the committer identity; if specified, it must be\n     -\tstuck to the option without a space.\n    -+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n    ++\tstuck to the option without a space. `--no-gpg-sign` is useful to\n     +\tcountermand both `commit.gpgSign` configuration variable, and\n    -+\tearlier \"--gpg-sign\".\n    ++\tearlier `--gpg-sign`.\n      \n      -q::\n      --quiet::\n2:  e1b6d7866d ! 2:  28ebbfe72a cherry-pick/revert: honour --no-gpg-sign in all case\n    @@ Documentation/git-cherry-pick.txt: effect to your index in a row.\n      \tGPG-sign commits. The `keyid` argument is optional and\n      \tdefaults to the committer identity; if specified, it must be\n     -\tstuck to the option without a space.\n    -+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n    ++\tstuck to the option without a space. `--no-gpg-sign` is useful to\n     +\tcountermand both `commit.gpgSign` configuration variable, and\n    -+\tearlier \"--gpg-sign\".\n    ++\tearlier `--gpg-sign`.\n      \n      --ff::\n      \tIf the current HEAD is the same as the parent of the\n    @@ Documentation/git-revert.txt: effect to your index in a row.\n      \tGPG-sign commits. The `keyid` argument is optional and\n      \tdefaults to the committer identity; if specified, it must be\n     -\tstuck to the option without a space.\n    -+\tstuck to the option without a space. \"--no-gpg-sign\" is useful to\n    ++\tstuck to the option without a space. `--no-gpg-sign` is useful to\n     +\tcountermand both `commit.gpgSign` configuration variable, and\n    -+\tearlier \"--gpg-sign\".\n    ++\tearlier `--gpg-sign`.\n      \n      -s::\n      --signoff::\n3:  9cc14b52e4 < -:  ---------- Documentation: document am --no-gpg-sign\n4:  801750016e < -:  ---------- Documentation: reword commit --no-gpg-sign\n-:  ---------- > 3:  340374fb68 Documentation: document am --no-gpg-sign\n-:  ---------- > 4:  1b952f7348 Documentation: reword commit --no-gpg-sign\n-:  ---------- > 5:  685832b069 Documentation: merge commit-tree --[no-]gpg-sign\n5:  857178defd ! 6:  b1a3d42355 Documentation: document merge option --no-gpg-sign\n    @@ Documentation/merge-options.txt: When not possible, refuse to merge and exit wit\n      \tGPG-sign the resulting merge commit. The `keyid` argument is\n      \toptional and defaults to the committer identity; if specified,\n     -\tit must be stuck to the option without a space.\n    -+\tit must be stuck to the option without a space. \"--no-gpg-sign\"\n    ++\tit must be stuck to the option without a space. `--no-gpg-sign`\n     +\tis useful to countermand both `commit.gpgSign` configuration variable,\n    -+\tand earlier \"--gpg-sign\".\n    ++\tand earlier `--gpg-sign`.\n      \n      --log[=<n>]::\n      --no-log::\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394649","messageId":"b601c99f7b947aa86c10976d9ebcef8e7a917b9b.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 1/6] rebase.c: honour --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:02Z","receivedAt":"2020-04-03T10:28:36Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-rebase.txt |  5 ++-\n builtin/rebase.c             |  7 ++--\n t/t3435-rebase-gpg-sign.sh   | 71 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 79 insertions(+), 4 deletions(-)\n create mode 100755 t/t3435-rebase-gpg-sign.sh\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex f7a6033607..19e280f93f 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -354,9 +354,12 @@ See also INCOMPATIBLE OPTIONS below.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n \n -q::\n --quiet::\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 27a07d4e78..7e2ad66e9e 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1593,6 +1593,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \n \toptions.allow_empty_message = 1;\n \tgit_config(rebase_config, &options);\n+\t/* options.gpg_sign_opt will be either \"-S\" or NULL */\n+\tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n+\tFREE_AND_NULL(options.gpg_sign_opt);\n \n \tif (options.use_legacy_rebase ||\n \t    !git_env_bool(\"GIT_TEST_REBASE_USE_BUILTIN\", -1))\n@@ -1823,10 +1826,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \tif (options.empty != EMPTY_UNSPECIFIED)\n \t\timply_merge(&options, \"--empty\");\n \n-\tif (gpg_sign) {\n-\t\tfree(options.gpg_sign_opt);\n+\tif (gpg_sign)\n \t\toptions.gpg_sign_opt = xstrfmt(\"-S%s\", gpg_sign);\n-\t}\n \n \tif (exec.nr) {\n \t\tint i;\ndiff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh\nnew file mode 100755\nindex 0000000000..b47c59c190\n--- /dev/null\n+++ b/t/t3435-rebase-gpg-sign.sh\n@@ -0,0 +1,71 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2020 Doan Tran Cong Danh\n+#\n+\n+test_description='test rebase --[no-]gpg-sign'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-rebase.sh\"\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n+\n+if ! test_have_prereq GPG\n+then\n+\tskip_all='skip all test rebase --[no-]gpg-sign, gpg not available'\n+\ttest_done\n+fi\n+\n+test_rebase_gpg_sign () {\n+\tlocal must_fail= will=will fake_editor=\n+\tif test \"x$1\" = \"x!\"\n+\tthen\n+\t\tmust_fail=test_must_fail\n+\t\twill=\"won't\"\n+\t\tshift\n+\tfi\n+\tconf=$1\n+\tshift\n+\ttest_expect_success \"rebase $* with commit.gpgsign=$conf $will sign commit\" \"\n+\t\tgit reset two &&\n+\t\tgit config commit.gpgsign $conf &&\n+\t\tset_fake_editor &&\n+\t\tFAKE_LINES='r 1 p 2' git rebase --force-rebase --root $* &&\n+\t\t$must_fail git verify-commit HEAD^ &&\n+\t\t$must_fail git verify-commit HEAD\n+\t\"\n+}\n+\n+test_expect_success 'setup' '\n+\ttest_commit one &&\n+\ttest_commit two &&\n+\ttest_must_fail git verify-commit HEAD &&\n+\ttest_must_fail git verify-commit HEAD^\n+'\n+\n+test_expect_success 'setup: merge commit' '\n+\ttest_commit fork-point &&\n+\tgit switch -c side &&\n+\ttest_commit three &&\n+\tgit switch master &&\n+\tgit merge --no-ff side &&\n+\tgit tag merged\n+'\n+\n+test_rebase_gpg_sign ! false\n+test_rebase_gpg_sign   true\n+test_rebase_gpg_sign ! true  --no-gpg-sign\n+test_rebase_gpg_sign ! true  --gpg-sign --no-gpg-sign\n+test_rebase_gpg_sign   false --no-gpg-sign --gpg-sign\n+test_rebase_gpg_sign   true  -i\n+test_rebase_gpg_sign ! true  -i --no-gpg-sign\n+test_rebase_gpg_sign ! true  -i --gpg-sign --no-gpg-sign\n+test_rebase_gpg_sign   false -i --no-gpg-sign --gpg-sign\n+\n+test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '\n+\tgit reset --hard merged &&\n+\tgit config commit.gpgsign true &&\n+\tgit rebase -p --no-gpg-sign --onto=one fork-point master &&\n+\ttest_must_fail git verify-commit HEAD\n+'\n+\n+test_done\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394650","messageId":"28ebbfe72a04b787fb92702199efea663a6b7ee5.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 2/6] cherry-pick/revert: honour --no-gpg-sign in all case","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:03Z","receivedAt":"2020-04-03T10:28:38Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"{cherry-pick,revert} --edit hasn't honoured --no-gpg-sign yet.\n\nPass this option down to git-commit to honour it.\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-cherry-pick.txt |  5 +-\n Documentation/git-revert.txt      |  5 +-\n sequencer.c                       |  2 +\n t/t3514-cherry-pick-revert-gpg.sh | 86 +++++++++++++++++++++++++++++++\n 4 files changed, 96 insertions(+), 2 deletions(-)\n create mode 100755 t/t3514-cherry-pick-revert-gpg.sh\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex 83ce51aedf..75feeef08a 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -109,9 +109,12 @@ effect to your index in a row.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n \n --ff::\n \tIf the current HEAD is the same as the parent of the\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 9d22270757..044276e9da 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -90,9 +90,12 @@ effect to your index in a row.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n \n -s::\n --signoff::\ndiff --git a/sequencer.c b/sequencer.c\nindex 6fd2674632..9969355de7 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -946,6 +946,8 @@ static int run_git_commit(struct repository *r,\n \t\targv_array_push(&cmd.args, \"--amend\");\n \tif (opts->gpg_sign)\n \t\targv_array_pushf(&cmd.args, \"-S%s\", opts->gpg_sign);\n+\telse\n+\t\targv_array_push(&cmd.args, \"--no-gpg-sign\");\n \tif (defmsg)\n \t\targv_array_pushl(&cmd.args, \"-F\", defmsg, NULL);\n \telse if (!(flags & EDIT_MSG))\ndiff --git a/t/t3514-cherry-pick-revert-gpg.sh b/t/t3514-cherry-pick-revert-gpg.sh\nnew file mode 100755\nindex 0000000000..5b2e250eaa\n--- /dev/null\n+++ b/t/t3514-cherry-pick-revert-gpg.sh\n@@ -0,0 +1,86 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2020 Doan Tran Cong Danh\n+#\n+\n+test_description='test {cherry-pick,revert} --[no-]gpg-sign'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n+\n+if ! test_have_prereq GPG\n+then\n+\tskip_all='skip all test {cherry-pick,revert} --[no-]gpg-sign, gpg not available'\n+\ttest_done\n+fi\n+\n+test_gpg_sign () {\n+\tlocal must_fail= will=will fake_editor=\n+\tif test \"x$1\" = \"x!\"\n+\tthen\n+\t\tmust_fail=test_must_fail\n+\t\twill=\"won't\"\n+\t\tshift\n+\tfi\n+\tconf=$1\n+\tcmd=$2\n+\tcmit=$3\n+\tshift 3\n+\ttest_expect_success \"$cmd $* $cmit with commit.gpgsign=$conf $will sign commit\" \"\n+\t\tgit reset --hard tip &&\n+\t\tgit config commit.gpgsign $conf &&\n+\t\tgit $cmd $* $cmit &&\n+\t\tgit rev-list tip.. >rev-list &&\n+\t\t$must_fail git verify-commit \\$(cat rev-list)\n+\t\"\n+}\n+\n+test_expect_success 'setup' '\n+\ttest_commit one &&\n+\tgit switch -c side &&\n+\ttest_commit side1 &&\n+\ttest_commit side2 &&\n+\tgit switch - &&\n+\ttest_commit two &&\n+\ttest_commit three &&\n+\ttest_commit tip\n+'\n+\n+test_gpg_sign ! false cherry-pick   side\n+test_gpg_sign ! false cherry-pick ..side\n+test_gpg_sign   true  cherry-pick   side\n+test_gpg_sign   true  cherry-pick ..side\n+test_gpg_sign ! true  cherry-pick   side --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick   side --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --gpg-sign --no-gpg-sign\n+test_gpg_sign   false cherry-pick   side --no-gpg-sign --gpg-sign\n+test_gpg_sign   false cherry-pick ..side --no-gpg-sign --gpg-sign\n+test_gpg_sign   true  cherry-pick   side --edit\n+test_gpg_sign   true  cherry-pick ..side --edit\n+test_gpg_sign ! true  cherry-pick   side --edit --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --edit --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick   side --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  cherry-pick ..side --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false cherry-pick   side --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   false cherry-pick ..side --edit --no-gpg-sign --gpg-sign\n+\n+test_gpg_sign ! false revert HEAD  --edit\n+test_gpg_sign ! false revert two.. --edit\n+test_gpg_sign   true  revert HEAD  --edit\n+test_gpg_sign   true  revert two.. --edit\n+test_gpg_sign ! true  revert HEAD  --edit --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --edit --no-gpg-sign\n+test_gpg_sign ! true  revert HEAD  --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false revert HEAD  --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   false revert two.. --edit --no-gpg-sign --gpg-sign\n+test_gpg_sign   true  revert HEAD  --no-edit\n+test_gpg_sign   true  revert two.. --no-edit\n+test_gpg_sign ! true  revert HEAD  --no-edit --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --no-edit --no-gpg-sign\n+test_gpg_sign ! true  revert HEAD  --no-edit --gpg-sign --no-gpg-sign\n+test_gpg_sign ! true  revert two.. --no-edit --gpg-sign --no-gpg-sign\n+test_gpg_sign   false revert HEAD  --no-edit --no-gpg-sign --gpg-sign\n+\n+test_done\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394651","messageId":"340374fb68e6b442c2ab4ceb50c49ae0471fd240.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 3/6] Documentation: document am --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:04Z","receivedAt":"2020-04-03T10:28:40Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-am.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex ab5754e05d..38c0852139 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -148,9 +148,12 @@ default.   You can use `--no-utf8` to override this.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n \n --continue::\n -r::\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394652","messageId":"1b952f7348c285ef50594a3b29907daee56ed2cc.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 4/6] Documentation: reword commit --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:05Z","receivedAt":"2020-04-03T10:28:42Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Merge with --gpg-sign option, and clarify that --no-gpg-sign also\noverride earlier --gpg-sign.\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-commit.txt | 9 ++++-----\n 1 file changed, 4 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 13f653989f..a3baea32ae 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -348,13 +348,12 @@ changes to tracked files.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n-\n---no-gpg-sign::\n-\tCountermand `commit.gpgSign` configuration variable that is\n-\tset to force each and every commit to be signed.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n \n \\--::\n \tDo not interpret any more arguments as options.\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394653","messageId":"685832b06965225fa2a7cefd5955cacdfb44d5fe.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 5/6] Documentation: merge commit-tree --[no-]gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:06Z","receivedAt":"2020-04-03T10:28:44Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/git-commit-tree.txt | 8 +++-----\n 1 file changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt\nindex ec15ee8d6f..2e2c581098 100644\n--- a/Documentation/git-commit-tree.txt\n+++ b/Documentation/git-commit-tree.txt\n@@ -61,13 +61,11 @@ OPTIONS\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign commits. The `keyid` argument is optional and\n \tdefaults to the committer identity; if specified, it must be\n-\tstuck to the option without a space.\n-\n---no-gpg-sign::\n-\tDo not GPG-sign commit, to countermand a `--gpg-sign` option\n-\tgiven earlier on the command line.\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand a `--gpg-sign` option given earlier on the command line.\n \n Commit Information\n ------------------\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394654","messageId":"b1a3d42355aeafab2c68eeab7abd4247274aea10.1585909453.git.congdanhqx@gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"[PATCH v3 6/6] Documentation: document merge option --no-gpg-sign","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T10:28:07Z","receivedAt":"2020-04-03T10:28:46Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/merge-options.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt\nindex 40dc4f5e8c..fb3a6e8d42 100644\n--- a/Documentation/merge-options.txt\n+++ b/Documentation/merge-options.txt\n@@ -61,9 +61,12 @@ When not possible, refuse to merge and exit with a non-zero status.\n \n -S[<keyid>]::\n --gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n \tGPG-sign the resulting merge commit. The `keyid` argument is\n \toptional and defaults to the committer identity; if specified,\n-\tit must be stuck to the option without a space.\n+\tit must be stuck to the option without a space. `--no-gpg-sign`\n+\tis useful to countermand both `commit.gpgSign` configuration variable,\n+\tand earlier `--gpg-sign`.\n \n --log[=<n>]::\n --no-log::\n-- \n2.26.0.334.g6536db25bb\n\n"},{"id":"394664","messageId":"180436a8-5b50-88b8-f3f1-1ec6aff41c9e@gmail.com","threadId":"53136","inReplyTo":"28ebbfe72a04b787fb92702199efea663a6b7ee5.1585909453.git.congdanhqx@gmail.com","subject":"Re: [PATCH v3 2/6] cherry-pick/revert: honour --no-gpg-sign in all case","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2020-04-03T13:43:05Z","receivedAt":"2020-04-03T13:43:12Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Đoàn\n\nOn 03/04/2020 11:28, Đoàn Trần Công Danh wrote:\n> {cherry-pick,revert} --edit hasn't honoured --no-gpg-sign yet.\n> \n> Pass this option down to git-commit to honour it.\n\nI did wonder if try_to_commit() needed any changes as we do not fork \n'git commit' unless the message is being edited but the tests seem to \ncover that case. It might be worth checking the code just to be sure if \nyou haven't done so already.\n\nBest Wishes\n\nPhillip\n\n> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> ---\n>   Documentation/git-cherry-pick.txt |  5 +-\n>   Documentation/git-revert.txt      |  5 +-\n>   sequencer.c                       |  2 +\n>   t/t3514-cherry-pick-revert-gpg.sh | 86 +++++++++++++++++++++++++++++++\n>   4 files changed, 96 insertions(+), 2 deletions(-)\n>   create mode 100755 t/t3514-cherry-pick-revert-gpg.sh\n> \n> diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\n> index 83ce51aedf..75feeef08a 100644\n> --- a/Documentation/git-cherry-pick.txt\n> +++ b/Documentation/git-cherry-pick.txt\n> @@ -109,9 +109,12 @@ effect to your index in a row.\n>   \n>   -S[<keyid>]::\n>   --gpg-sign[=<keyid>]::\n> +--no-gpg-sign::\n>   \tGPG-sign commits. The `keyid` argument is optional and\n>   \tdefaults to the committer identity; if specified, it must be\n> -\tstuck to the option without a space.\n> +\tstuck to the option without a space. `--no-gpg-sign` is useful to\n> +\tcountermand both `commit.gpgSign` configuration variable, and\n> +\tearlier `--gpg-sign`.\n>   \n>   --ff::\n>   \tIf the current HEAD is the same as the parent of the\n> diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\n> index 9d22270757..044276e9da 100644\n> --- a/Documentation/git-revert.txt\n> +++ b/Documentation/git-revert.txt\n> @@ -90,9 +90,12 @@ effect to your index in a row.\n>   \n>   -S[<keyid>]::\n>   --gpg-sign[=<keyid>]::\n> +--no-gpg-sign::\n>   \tGPG-sign commits. The `keyid` argument is optional and\n>   \tdefaults to the committer identity; if specified, it must be\n> -\tstuck to the option without a space.\n> +\tstuck to the option without a space. `--no-gpg-sign` is useful to\n> +\tcountermand both `commit.gpgSign` configuration variable, and\n> +\tearlier `--gpg-sign`.\n>   \n>   -s::\n>   --signoff::\n> diff --git a/sequencer.c b/sequencer.c\n> index 6fd2674632..9969355de7 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -946,6 +946,8 @@ static int run_git_commit(struct repository *r,\n>   \t\targv_array_push(&cmd.args, \"--amend\");\n>   \tif (opts->gpg_sign)\n>   \t\targv_array_pushf(&cmd.args, \"-S%s\", opts->gpg_sign);\n> +\telse\n> +\t\targv_array_push(&cmd.args, \"--no-gpg-sign\");\n>   \tif (defmsg)\n>   \t\targv_array_pushl(&cmd.args, \"-F\", defmsg, NULL);\n>   \telse if (!(flags & EDIT_MSG))\n> diff --git a/t/t3514-cherry-pick-revert-gpg.sh b/t/t3514-cherry-pick-revert-gpg.sh\n> new file mode 100755\n> index 0000000000..5b2e250eaa\n> --- /dev/null\n> +++ b/t/t3514-cherry-pick-revert-gpg.sh\n> @@ -0,0 +1,86 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2020 Doan Tran Cong Danh\n> +#\n> +\n> +test_description='test {cherry-pick,revert} --[no-]gpg-sign'\n> +\n> +. ./test-lib.sh\n> +. \"$TEST_DIRECTORY/lib-gpg.sh\"\n> +\n> +if ! test_have_prereq GPG\n> +then\n> +\tskip_all='skip all test {cherry-pick,revert} --[no-]gpg-sign, gpg not available'\n> +\ttest_done\n> +fi\n> +\n> +test_gpg_sign () {\n> +\tlocal must_fail= will=will fake_editor=\n> +\tif test \"x$1\" = \"x!\"\n> +\tthen\n> +\t\tmust_fail=test_must_fail\n> +\t\twill=\"won't\"\n> +\t\tshift\n> +\tfi\n> +\tconf=$1\n> +\tcmd=$2\n> +\tcmit=$3\n> +\tshift 3\n> +\ttest_expect_success \"$cmd $* $cmit with commit.gpgsign=$conf $will sign commit\" \"\n> +\t\tgit reset --hard tip &&\n> +\t\tgit config commit.gpgsign $conf &&\n> +\t\tgit $cmd $* $cmit &&\n> +\t\tgit rev-list tip.. >rev-list &&\n> +\t\t$must_fail git verify-commit \\$(cat rev-list)\n> +\t\"\n> +}\n> +\n> +test_expect_success 'setup' '\n> +\ttest_commit one &&\n> +\tgit switch -c side &&\n> +\ttest_commit side1 &&\n> +\ttest_commit side2 &&\n> +\tgit switch - &&\n> +\ttest_commit two &&\n> +\ttest_commit three &&\n> +\ttest_commit tip\n> +'\n> +\n> +test_gpg_sign ! false cherry-pick   side\n> +test_gpg_sign ! false cherry-pick ..side\n> +test_gpg_sign   true  cherry-pick   side\n> +test_gpg_sign   true  cherry-pick ..side\n> +test_gpg_sign ! true  cherry-pick   side --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick ..side --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick   side --gpg-sign --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick ..side --gpg-sign --no-gpg-sign\n> +test_gpg_sign   false cherry-pick   side --no-gpg-sign --gpg-sign\n> +test_gpg_sign   false cherry-pick ..side --no-gpg-sign --gpg-sign\n> +test_gpg_sign   true  cherry-pick   side --edit\n> +test_gpg_sign   true  cherry-pick ..side --edit\n> +test_gpg_sign ! true  cherry-pick   side --edit --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick ..side --edit --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick   side --edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign ! true  cherry-pick ..side --edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign   false cherry-pick   side --edit --no-gpg-sign --gpg-sign\n> +test_gpg_sign   false cherry-pick ..side --edit --no-gpg-sign --gpg-sign\n> +\n> +test_gpg_sign ! false revert HEAD  --edit\n> +test_gpg_sign ! false revert two.. --edit\n> +test_gpg_sign   true  revert HEAD  --edit\n> +test_gpg_sign   true  revert two.. --edit\n> +test_gpg_sign ! true  revert HEAD  --edit --no-gpg-sign\n> +test_gpg_sign ! true  revert two.. --edit --no-gpg-sign\n> +test_gpg_sign ! true  revert HEAD  --edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign ! true  revert two.. --edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign   false revert HEAD  --edit --no-gpg-sign --gpg-sign\n> +test_gpg_sign   false revert two.. --edit --no-gpg-sign --gpg-sign\n> +test_gpg_sign   true  revert HEAD  --no-edit\n> +test_gpg_sign   true  revert two.. --no-edit\n> +test_gpg_sign ! true  revert HEAD  --no-edit --no-gpg-sign\n> +test_gpg_sign ! true  revert two.. --no-edit --no-gpg-sign\n> +test_gpg_sign ! true  revert HEAD  --no-edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign ! true  revert two.. --no-edit --gpg-sign --no-gpg-sign\n> +test_gpg_sign   false revert HEAD  --no-edit --no-gpg-sign --gpg-sign\n> +\n> +test_done\n> \n"},{"id":"394666","messageId":"20200403142608.GE32101@danh.dev","threadId":"53136","inReplyTo":"180436a8-5b50-88b8-f3f1-1ec6aff41c9e@gmail.com","subject":"Re: [PATCH v3 2/6] cherry-pick/revert: honour --no-gpg-sign in all case","fromName":"Danh Doan","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-04-03T14:26:08Z","receivedAt":"2020-04-03T14:26:14Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2020-04-03 14:43:05+0100, Phillip Wood <phillip.wood123@gmail.com> wrote:\n> Hi Đoàn\n> \n> On 03/04/2020 11:28, Đoàn Trần Công Danh wrote:\n> > {cherry-pick,revert} --edit hasn't honoured --no-gpg-sign yet.\n> > \n> > Pass this option down to git-commit to honour it.\n> \n> I did wonder if try_to_commit() needed any changes as we do not fork 'git\n> commit' unless the message is being edited but the tests seem to cover that\n> case. It might be worth checking the code just to be sure if you haven't\n> done so already.\n\ntry_to_commit pass opts->gpg_sign to commit_tree_extended (sequencer.c:1413)\n\nif \"--edit\" was passed into cherry-pick and/or revert (--edit is\ndefault if revert run in tty), sequencer.c will run git-commit just\n6 lines above it.\n\n-- \nDanh\n"},{"id":"394682","messageId":"xmqqr1x4za4f.fsf@gitster.c.googlers.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"Re: [PATCH v3 0/6] Honour and Document --no-gpg-sign","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-03T18:40:00Z","receivedAt":"2020-04-03T18:40:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:\n\n> The subcommand `git commit` supports a `--no-gpg-sign` argument, which is\n> useful incases where e.g. a GPG key is specified in `.gitconfig`,\n> but is located on a hardware key that may not currently be attached to\n> the system.\n\nI see the mark-up in the documentation pages have been changed, and\nthey all good correct.\n\nThanks for an update.  Will queue.\n"},{"id":"394777","messageId":"CAN0heSrrhrPSqMr8hovdFxbM7+rYMS004KDr1NKuM8JwKXsxuA@mail.gmail.com","threadId":"53136","inReplyTo":"cover.1585909453.git.congdanhqx@gmail.com","subject":"Re: [PATCH v3 0/6] Honour and Document --no-gpg-sign","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-04-04T14:36:36Z","receivedAt":"2020-04-04T14:36:51Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Fri, 3 Apr 2020 at 12:28, Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:\n>\n> Multiple commands that understand --gpg-sign but haven't understand\n> --no-gpg-sign, yet.\n>\n> Also, document more commands that honours --no-gpg-sign\n>\n> Change in v3 since v2:\n> - Use `backticks` instead of \"dquote\" for options\n\nCool, thanks!\n\n> - Add missing \"--no-gpg-sign::\"\n> - Merge git-commit-tree --[no-]gpg-sign\"\n\nMartin\n"}]}