{"thread":{"id":"45689","subject":"[PATCHv2] rebase: pass --[no]-signoff option to git am","startedAt":"2017-04-14T16:51:29Z","lastAt":"2017-04-14T22:54:19Z","messageCount":3,"participants":["Giuseppe Bilotta","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"316819","messageId":"20170414165044.13990-1-giuseppe.bilotta@gmail.com","threadId":"45689","inReplyTo":null,"subject":"[PATCHv2] rebase: pass --[no]-signoff option to git am","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2017-04-14T16:50:44Z","receivedAt":"2017-04-14T16:51:29Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This makes it easy to sign off a whole patchset before submission.\n\nTo make things work, we also fix a design issue in git-am that made it\nignore the signoff option during rebase (specifically, signoff was\nhandled in parse_mail(), but not in parse_mail_rebasing()).\n\nThis is trivially fixed by moving the conditional addition of the\nsignoff from parse_mail() to the caller (am_run()), after either of the\nparse_mail*() functions were called.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n Documentation/git-rebase.txt | 5 +++++\n builtin/am.c                 | 6 +++---\n git-rebase.sh                | 3 ++-\n 3 files changed, 10 insertions(+), 4 deletions(-)\n\nCompared to v1, we also pass --no-signoff (which is accepted by git-am to\noverride a preceding --signoff, so it works the same way) and make sure\nthat git-am actually obeys --signoff while rebasing (which was not the\ncase anymore since df2760a576a8d26e26a6a11aa497e347c7402fd3).\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 67d48e6883..e6f0b93337 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -385,6 +385,11 @@ have the long commit hash prepended to the format.\n \tRecreate merge commits instead of flattening the history by replaying\n \tcommits a merge commit introduces. Merge conflict resolutions or manual\n \tamendments to merge commits are not preserved.\n+\n+--signoff::\n+\tThis flag is passed to 'git am' to sign off all the rebased\n+\tcommits (see linkgit:git-am[1]).\n+\n +\n This uses the `--interactive` machinery internally, but combining it\n with the `--interactive` option explicitly is generally not a good\ndiff --git a/builtin/am.c b/builtin/am.c\nindex f7a7a971fb..d072027b5a 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1321,9 +1321,6 @@ static int parse_mail(struct am_state *state, const char *mail)\n \tstrbuf_addbuf(&msg, &mi.log_message);\n \tstrbuf_stripspace(&msg, 0);\n \n-\tif (state->signoff)\n-\t\tam_signoff(&msg);\n-\n \tassert(!state->author_name);\n \tstate->author_name = strbuf_detach(&author_name, NULL);\n \n@@ -1848,6 +1845,9 @@ static void am_run(struct am_state *state, int resume)\n \t\t\tif (skip)\n \t\t\t\tgoto next; /* mail should be skipped */\n \n+\t\t\tif (state->signoff)\n+\t\t\t\tam_append_signoff(state);\n+\n \t\t\twrite_author_script(state);\n \t\t\twrite_commit_msg(state);\n \t\t}\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 48d7c5ded4..e2ec5c092d 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -34,6 +34,7 @@ root!              rebase all reachable commits up to the root(s)\n autosquash         move commits that begin with squash!/fixup! under -i\n committer-date-is-author-date! passed to 'git am'\n ignore-date!       passed to 'git am'\n+[no]-signoff!      passed to 'git am'\n whitespace=!       passed to 'git apply'\n ignore-whitespace! passed to 'git apply'\n C=!                passed to 'git apply'\n@@ -321,7 +322,7 @@ do\n \t--ignore-whitespace)\n \t\tgit_am_opt=\"$git_am_opt $1\"\n \t\t;;\n-\t--committer-date-is-author-date|--ignore-date)\n+\t--committer-date-is-author-date|--ignore-date|--signoff|--no-signoff)\n \t\tgit_am_opt=\"$git_am_opt $1\"\n \t\tforce_rebase=t\n \t\t;;\n-- \n2.12.2.765.g845dc5dc05\n\n"},{"id":"316865","messageId":"CACBZZX4_yTbJ77XZYGGyh1B_Lo=OqteQTDXyaSjdoR9RvVuHAA@mail.gmail.com","threadId":"45689","inReplyTo":"20170414165044.13990-1-giuseppe.bilotta@gmail.com","subject":"Re: [PATCHv2] rebase: pass --[no]-signoff option to git am","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-14T22:44:56Z","receivedAt":"2017-04-14T22:45:22Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Apr 14, 2017 at 6:50 PM, Giuseppe Bilotta\n<giuseppe.bilotta@gmail.com> wrote:\n\nIt should be --[no-]signoff, not --[no]-signoff, since the latter\nimplies that ---signoff works, see my 2c7ee986c7 where I fixed some\nexisting instances of this.\n"},{"id":"316866","messageId":"CAOxFTcw5iePfT55=nDVvFUsjEo1rHMxwOd_r3JCe3+8sfd7QPQ@mail.gmail.com","threadId":"45689","inReplyTo":"CACBZZX4_yTbJ77XZYGGyh1B_Lo=OqteQTDXyaSjdoR9RvVuHAA@mail.gmail.com","subject":"Re: [PATCHv2] rebase: pass --[no]-signoff option to git am","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2017-04-14T22:53:53Z","receivedAt":"2017-04-14T22:54:19Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sat, Apr 15, 2017 at 12:44 AM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> On Fri, Apr 14, 2017 at 6:50 PM, Giuseppe Bilotta\n> <giuseppe.bilotta@gmail.com> wrote:\n>\n> It should be --[no-]signoff, not --[no]-signoff, since the latter\n> implies that ---signoff works, see my 2c7ee986c7 where I fixed some\n> existing instances of this.\n\nOops, yes of course. I'll resubmit.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}