{"thread":{"id":"44786","subject":"[PATCH v3] am: add am.signoff add config variable","startedAt":"2016-12-28T22:56:00Z","lastAt":"2016-12-29T15:49:41Z","messageCount":3,"participants":["Eduardo Habkost","Andreas Schwab"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"308476","messageId":"20161228225544.16388-1-ehabkost@redhat.com","threadId":"44786","inReplyTo":null,"subject":"[PATCH v3] am: add am.signoff add config variable","fromName":"Eduardo Habkost","fromEmail":"ehabkost@redhat.com","sentAt":"2016-12-28T22:55:44Z","receivedAt":"2016-12-28T22:56:00Z","isPatch":true,"sender":{"key":"ehabkost@redhat.com","avatar":null},"body":"git-am has options to enable --message-id and --3way by default,\nbut no option to enable --signoff by default. Add a \"am.signoff\"\nconfig option.\n\nSigned-off-by: Eduardo Habkost <ehabkost@redhat.com>\n---\nChanges v1 -> v2:\n* Added documentation to Documentation/git-am.txt and\n  Documentation/config.txt\n* Added test cases to t4150-am.sh\n\nChanges v2 -> v3:\n* Fix doc to mention \"--[no-]signoff\" instead of \"--[no]-signoff\"\n  * Reported-by: Andreas Schwab <schwab@linux-m68k.org>\n* Add missing test_cmp line on test code\n* Use \"! grep\" instead of \"$(grep -c ...)\" -eq 0\n  * Suggested-by: Stefan Beller <sbeller@google.com>\n---\n Documentation/config.txt |  5 +++++\n Documentation/git-am.txt |  6 ++++--\n builtin/am.c             |  2 ++\n t/t4150-am.sh            | 26 ++++++++++++++++++++++++++\n 4 files changed, 37 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 30cb94610..6b2990203 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -822,6 +822,11 @@ am.keepcr::\n \tby giving `--no-keep-cr` from the command line.\n \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n \n+am.signoff::\n+\tIf true, git-am will add a `Signed-off-by:` line to the commit\n+\tmessage. See the signoff option in linkgit:git-commit[1] for\n+\tmore information.\n+\n am.threeWay::\n \tBy default, `git am` will fail if the patch does not apply cleanly. When\n \tset to true, this setting tells `git am` to fall back on 3-way merge if\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 12879e402..1f14986c7 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -9,7 +9,7 @@ git-am - Apply a series of patches from a mailbox\n SYNOPSIS\n --------\n [verse]\n-'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]\n+'git am' [--[no-]signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]\n \t [--[no-]3way] [--interactive] [--committer-date-is-author-date]\n \t [--ignore-date] [--ignore-space-change | --ignore-whitespace]\n \t [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]\n@@ -32,10 +32,12 @@ OPTIONS\n \tIf you supply directories, they will be treated as Maildirs.\n \n -s::\n---signoff::\n+--[no-]-signoff::\n \tAdd a `Signed-off-by:` line to the commit message, using\n \tthe committer identity of yourself.\n \tSee the signoff option in linkgit:git-commit[1] for more information.\n+\tThe `am.signoff` configuration variable can be used to specify the\n+\tdefault behaviour.  `--no-signoff` is useful to override `am.signoff`.\n \n -k::\n --keep::\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 31fb60578..d2e02334f 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -154,6 +154,8 @@ static void am_state_init(struct am_state *state, const char *dir)\n \n \tgit_config_get_bool(\"am.messageid\", &state->message_id);\n \n+\tgit_config_get_bool(\"am.signoff\", &state->signoff);\n+\n \tstate->scissors = SCISSORS_UNSET;\n \n \targv_array_init(&state->git_apply_opts);\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 89a5bacac..d65c8e5c4 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -479,6 +479,32 @@ test_expect_success 'am --signoff adds Signed-off-by: line' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--no-signoff overrides am.signoff' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard first &&\n+\ttest_config am.signoff true &&\n+\tgit am --no-signoff <patch2 &&\n+\tprintf \"%s\\n\" \"$signoff\" >expected &&\n+\tgit cat-file commit HEAD^ | grep \"Signed-off-by:\" >actual &&\n+\ttest_cmp expected actual &&\n+\tgit cat-file commit HEAD > actual &&\n+\t! grep -q \"Signed-off-by:\" actual\n+'\n+\n+test_expect_success 'am.signoff adds Signed-off-by: line' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard first &&\n+\ttest_config am.signoff true &&\n+\tgit am <patch2 &&\n+\tprintf \"%s\\n\" \"$signoff\" >expected &&\n+\techo \"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\" >>expected &&\n+\tgit cat-file commit HEAD^ | grep \"Signed-off-by:\" >actual &&\n+\ttest_cmp expected actual &&\n+\techo \"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\" >expected &&\n+\tgit cat-file commit HEAD | grep \"Signed-off-by:\" >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'am stays in branch' '\n \techo refs/heads/master2 >expected &&\n \tgit symbolic-ref HEAD >actual &&\n-- \n2.11.0.259.g40922b1\n\n"},{"id":"308480","messageId":"m2wpejb1zn.fsf@linux-m68k.org","threadId":"44786","inReplyTo":"20161228225544.16388-1-ehabkost@redhat.com","subject":"Re: [PATCH v3] am: add am.signoff add config variable","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2016-12-29T07:58:36Z","receivedAt":"2016-12-29T07:58:50Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Dez 28 2016, Eduardo Habkost <ehabkost@redhat.com> wrote:\n\n> @@ -32,10 +32,12 @@ OPTIONS\n>  \tIf you supply directories, they will be treated as Maildirs.\n>  \n>  -s::\n> ---signoff::\n> +--[no-]-signoff::\n\nThat's one dash too much.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"308495","messageId":"20161229154931.GI3441@thinpad.lan.raisama.net","threadId":"44786","inReplyTo":"m2wpejb1zn.fsf@linux-m68k.org","subject":"Re: [PATCH v3] am: add am.signoff add config variable","fromName":"Eduardo Habkost","fromEmail":"ehabkost@redhat.com","sentAt":"2016-12-29T15:49:31Z","receivedAt":"2016-12-29T15:49:41Z","isPatch":true,"sender":{"key":"ehabkost@redhat.com","avatar":null},"body":"On Thu, Dec 29, 2016 at 08:58:36AM +0100, Andreas Schwab wrote:\n> On Dez 28 2016, Eduardo Habkost <ehabkost@redhat.com> wrote:\n> \n> > @@ -32,10 +32,12 @@ OPTIONS\n> >  \tIf you supply directories, they will be treated as Maildirs.\n> >  \n> >  -s::\n> > ---signoff::\n> > +--[no-]-signoff::\n> \n> That's one dash too much.\n\nOops. I can fix it in v4, but I will first wait to see what\nothers think about the legal implications of setting it by\ndefault (see point raised by Eric Wong on v1).\n\n-- \nEduardo\n"}]}