{"thread":{"id":"39717","subject":"[PATCH] commit: add commit.signoff config option","startedAt":"2015-06-25T07:30:54Z","lastAt":"2015-06-25T14:57:13Z","messageCount":4,"participants":["cmarcelo@gmail.com","Alexander Kuleshov","Remi Galan Alfonso","Caio Marcelo de Oliveira Filho"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"264807","messageId":"1435217454-5718-1-git-send-email-cmarcelo@gmail.com","threadId":"39717","inReplyTo":null,"subject":"[PATCH] commit: add commit.signoff config option","fromName":"","fromEmail":"cmarcelo@gmail.com","sentAt":"2015-06-25T07:30:54Z","receivedAt":"2015-06-25T07:30:54Z","isPatch":true,"sender":{"key":"cmarcelo@gmail.com","avatar":null},"body":"From: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com>\n\nIn projects that use Signed-off-by, it's convenient to include that line\nin the commit by default. The commit.signoff config option allows to add\nthat line in all commits automatically.\n\nDocument that this config option can be overriden by using\n--no-signoff.\n\nSigned-off-by: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com>\n---\n Documentation/config.txt     |  6 ++++++\n Documentation/git-commit.txt |  5 +++++\n builtin/commit.c             |  4 ++++\n t/t7500-commit.sh            | 22 ++++++++++++++++++++++\n 4 files changed, 37 insertions(+)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 3e37b93..e019f62 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1089,6 +1089,12 @@ commit.gpgSign::\n \tconvenient to use an agent to avoid typing your GPG passphrase\n \tseveral times.\n \n+commit.signoff::\n+\n+\tA boolean to enable/disable whether Signed-off-by line by the\n+\tcommitter should be added to all commits at the end of the\n+\tcommit log messages.  Defaults to false.\n+\n commit.status::\n \tA boolean to enable/disable inclusion of status information in the\n \tcommit message template when using an editor to prepare the commit\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 904dafa..7546c7a 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -156,6 +156,11 @@ OPTIONS\n \tAdd Signed-off-by line by the committer at the end of the commit\n \tlog message.\n \n+--no-signoff::\n+\tCountermand `commit.signoff` configuration, preventing a\n+\tSigned-off-by line to be added at the end of the commit log\n+\tmessage.\n+\n -n::\n --no-verify::\n \tThis option bypasses the pre-commit and commit-msg hooks.\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 254477f..5cfbe57 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1505,6 +1505,10 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \t\tsign_commit = git_config_bool(k, v) ? \"\" : NULL;\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"commit.signoff\")) {\n+\t\tsignoff = git_config_bool(k, v);\n+\t\treturn 0;\n+\t}\n \n \tstatus = git_gpg_config(k, v, NULL);\n \tif (status)\ndiff --git a/t/t7500-commit.sh b/t/t7500-commit.sh\nindex 116885a..fcb39b4 100755\n--- a/t/t7500-commit.sh\n+++ b/t/t7500-commit.sh\n@@ -179,6 +179,28 @@ test_expect_success '--signoff' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'commit.signoff config option' '\n+\tgit config commit.signoff true &&\n+\techo \"yet another content *narf*\" >> foo &&\n+\techo \"zort\" | git commit -F - foo &&\n+\tgit cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n+\tgit config --unset commit.signoff &&\n+\ttest_cmp expect output\n+'\n+\n+cat > expect <<EOF\n+no signed off by here\n+EOF\n+\n+test_expect_success '--no-signoff' '\n+\tgit config commit.signoff true &&\n+\techo \"yet another content *narf*\" >> foo &&\n+\techo \"no signed off by here\" | git commit --no-signoff -F - foo &&\n+\tgit cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n+\tgit config --unset commit.signoff &&\n+\ttest_cmp expect output\n+'\n+\n test_expect_success 'commit message from file (1)' '\n \tmkdir subdir &&\n \techo \"Log in top directory\" >log &&\n-- \n2.4.4.489.gc2a2b54.dirty\n"},{"id":"264809","messageId":"20150625082059.GA9937@alex-host","threadId":"39717","inReplyTo":"1435217454-5718-1-git-send-email-cmarcelo@gmail.com","subject":"Re: [PATCH] commit: add commit.signoff config option","fromName":"Alexander Kuleshov","fromEmail":"kuleshovmail@gmail.com","sentAt":"2015-06-25T08:21:03Z","receivedAt":"2015-06-25T08:21:03Z","isPatch":true,"sender":{"key":"kuleshovmail@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2699235?v=4"},"body":"On 06/25, cmarcelo@gmail.com wrote:\n> From: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com>\n> \n> In projects that use Signed-off-by, it's convenient to include that line\n> in the commit by default. The commit.signoff config option allows to add\n> that line in all commits automatically.\n> \n> Document that this config option can be overriden by using\n> --no-signoff.\n> \n\nHello, also would be great to have bash completion for the --no-signoff\n\nThank you.\n"},{"id":"264810","messageId":"1228200928.789773.1435221179871.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"39717","inReplyTo":"20150625082059.GA9937@alex-host","subject":"Re: [PATCH] commit: add commit.signoff config option","fromName":"Remi Galan Alfonso","fromEmail":"remi.galan-alfonso@ensimag.grenoble-inp.fr","sentAt":"2015-06-25T08:32:59Z","receivedAt":"2015-06-25T08:32:59Z","isPatch":true,"sender":{"key":"remi.galan-alfonso@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/12509162?v=4"},"body":"Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> writes:\n> +test_expect_success 'commit.signoff config option' '\n> +        git config commit.signoff true &&\n> +        echo \"yet another content *narf*\" >> foo &&\n> +        echo \"zort\" | git commit -F - foo &&\n> +        git cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n> +        git config --unset commit.signoff &&\n> +        test_cmp expect output\n> +'\n> +\n> +cat > expect <<EOF\n> +no signed off by here\n> +EOF\n> +\n> +test_expect_success '--no-signoff' '\n> +        git config commit.signoff true &&\n> +        echo \"yet another content *narf*\" >> foo &&\n> +        echo \"no signed off by here\" | git commit --no-signoff -F - foo &&\n> +        git cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n> +        git config --unset commit.signoff &&\n> +        test_cmp expect output\n> +'\n> +\n\nIn both tests, you should probably use 'test_config' instead of 'git\nconfig [...] git config --unset', it takes care of it for you (also\nshould prevent the case where the config is not unset when your test\nfails in the middle).\n\nFor example, the first test would be:\ntest_expect_success 'commit.signoff config option' '\n\ttest_config commit.signoff true &&\n\techo \"yet another content *narf*\" >> foo &&\n\techo \"zort\" | git commit -F - foo &&\n\tgit cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n\ttest_cmp expect output\n'\n\nRémi\n"},{"id":"264853","messageId":"CADstYCZ6cXrA-3a-NX1GANQ+tjL69D-V37Y0FGbs9dpF4Oa7rg@mail.gmail.com","threadId":"39717","inReplyTo":"1228200928.789773.1435221179871.JavaMail.zimbra@ensimag.grenoble-inp.fr","subject":"Re: [PATCH] commit: add commit.signoff config option","fromName":"Caio Marcelo de Oliveira Filho","fromEmail":"cmarcelo@gmail.com","sentAt":"2015-06-25T14:57:13Z","receivedAt":"2015-06-25T14:57:13Z","isPatch":true,"sender":{"key":"cmarcelo@gmail.com","avatar":null},"body":"> In both tests, you should probably use 'test_config' instead of 'git\n> config [...] git config --unset', it takes care of it for you (also\n> should prevent the case where the config is not unset when your test\n> fails in the middle).\n\nPosted a v2 with this improvement and the bash completion.\nThanks for the review.\n\n\n-- \nCaio Marcelo de Oliveira Filho\n"}]}