{"thread":{"id":"39724","subject":"[PATCH v2] commit: add commit.signoff config option","startedAt":"2015-06-25T14:50:07Z","lastAt":"2015-06-25T18:56:42Z","messageCount":7,"participants":["Caio Marcelo de Oliveira Filho","Junio C Hamano","Johannes Löthberg","Torsten Bögershausen","Matthieu Moy"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"264850","messageId":"1435243807-32112-1-git-send-email-cmarcelo@gmail.com","threadId":"39724","inReplyTo":null,"subject":"[PATCH v2] commit: add commit.signoff config option","fromName":"Caio Marcelo de Oliveira Filho","fromEmail":"cmarcelo@gmail.com","sentAt":"2015-06-25T14:50:07Z","receivedAt":"2015-06-25T14:50:07Z","isPatch":true,"sender":{"key":"cmarcelo@gmail.com","avatar":null},"body":"In projects that use Signed-off-by, it's convenient to include that line\nin the commit message by default. The commit.signoff config option\nallows to add that 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\nDifferences from v1:\n* Use test_config helper in the test\n* Add bash completion for commit and config\n\n Documentation/config.txt               |  6 ++++++\n Documentation/git-commit.txt           |  5 +++++\n builtin/commit.c                       |  4 ++++\n contrib/completion/git-completion.bash |  4 +++-\n t/t7500-commit.sh                      | 20 ++++++++++++++++++++\n 5 files changed, 38 insertions(+), 1 deletion(-)\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/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c97c648..7a79a89 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1123,7 +1123,8 @@ _git_commit ()\n \t\t;;\n \t--*)\n \t\t__gitcomp \"\n-\t\t\t--all --author= --signoff --verify --no-verify\n+\t\t\t--all --author=\n+\t\t\t--signoff --no-signoff --verify --no-verify\n \t\t\t--edit --no-edit\n \t\t\t--amend --include --only --interactive\n \t\t\t--dry-run --reuse-message= --reedit-message=\n@@ -2009,6 +2010,7 @@ _git_config ()\n \t\tcolor.status.untracked\n \t\tcolor.status.updated\n \t\tcolor.ui\n+\t\tcommit.signoff\n \t\tcommit.status\n \t\tcommit.template\n \t\tcore.abbrev\ndiff --git a/t/t7500-commit.sh b/t/t7500-commit.sh\nindex 116885a..949272d 100755\n--- a/t/t7500-commit.sh\n+++ b/t/t7500-commit.sh\n@@ -179,6 +179,26 @@ test_expect_success '--signoff' '\n \ttest_cmp expect output\n '\n \n+test_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+\n+cat > expect <<EOF\n+no signed off by here\n+EOF\n+\n+test_expect_success '--no-signoff' '\n+\ttest_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+\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.g5bc41de\n"},{"id":"264852","messageId":"xmqqlhf725xy.fsf@gitster.dls.corp.google.com","threadId":"39724","inReplyTo":"1435243807-32112-1-git-send-email-cmarcelo@gmail.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-25T14:55:37Z","receivedAt":"2015-06-25T14:55:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> writes:\n\n> In projects that use Signed-off-by, it's convenient to include that line\n> in the commit message by default. The commit.signoff config option\n\nHmm, I do not recall seeing v1 but that is OK.\n\nThe following immediately comes to mind.\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/51754/focus=51780\n"},{"id":"264854","messageId":"20150625150856.GC28349@leeloo.kyriasis.com","threadId":"39724","inReplyTo":"xmqqlhf725xy.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Johannes Löthberg","fromEmail":"johannes@kyriasis.com","sentAt":"2015-06-25T15:08:56Z","receivedAt":"2015-06-25T15:08:56Z","isPatch":true,"sender":{"key":"johannes@kyriasis.com","avatar":"https://gravatar.com/avatar/af2dea1b1759403329a1b7eaa28a07b5c5d1901e9f55723103d6324ffb7737ae?d=mp&s=160"},"body":"On 25/06, Junio C Hamano wrote:\n>Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> writes:\n>Hmm, I do not recall seeing v1 but that is OK.\n>\n>The following immediately comes to mind.\n>\n>http://thread.gmane.org/gmane.comp.version-control.git/51754/focus=51780\n\nTo be honest I'm not sure I buy that since we have `git commit -s`, \nwhich is just as easily added as a really simple git alias.\n\n-- \nSincerely,\n  Johannes Löthberg\n  PGP Key ID: 0x50FB9B273A9D0BB5\n  https://theos.kyriasis.com/~kyrias/\n"},{"id":"264858","messageId":"CADstYCamTxaLnZeYUma6t=KP3Fx2rQH3svqgCYP4WpAR9k_USg@mail.gmail.com","threadId":"39724","inReplyTo":"xmqqlhf725xy.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Caio Marcelo de Oliveira Filho","fromEmail":"cmarcelo@gmail.com","sentAt":"2015-06-25T15:19:22Z","receivedAt":"2015-06-25T15:19:22Z","isPatch":true,"sender":{"key":"cmarcelo@gmail.com","avatar":null},"body":"Hi,\n\n> Hmm, I do not recall seeing v1 but that is OK.\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/272635\nhttp://thread.gmane.org/gmane.comp.version-control.git/272636\n\n\n> The following immediately comes to mind.\n>\n> http://thread.gmane.org/gmane.comp.version-control.git/51754/focus=51780\n\nThanks for the reference, amazed that I ended up using the same title!\nFrom the thread:\n\n> Even though these lines are not digitally signed,\n> the intent of adding a Signed-off-by: line with your name is\n> that you are certifying its origin, according to the definition\n> of DCO (see Documentation/SubmittingPatches).  This should be a\n> conscious act from the signer's part, and making it automatic\n> with a config variable that you set once and forget makes it\n> much less meaningful.\n\nThis is a fair point. However I've seen that in practice, in some\ncases it's easier\nto consider the DCO as the rules for contributing to the entire\nproject. In those\ncases people tend to use commit templates or aliases or hooks, which in practice\nautomate the signing off act anyway.\n\nA similar concern probably applies to format.signOff option. Would be sufficient\nto add a note about conscious act (like format.signOff has) to the\nconfig description?\n\n\n-- \nCaio Marcelo de Oliveira Filho\n"},{"id":"264862","messageId":"xmqq4mlv22we.fsf@gitster.dls.corp.google.com","threadId":"39724","inReplyTo":"CADstYCamTxaLnZeYUma6t=KP3Fx2rQH3svqgCYP4WpAR9k_USg@mail.gmail.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-25T16:01:21Z","receivedAt":"2015-06-25T16:01:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> writes:\n\n> A similar concern probably applies to format.signOff option. Would\n> be sufficient to add a note about conscious act (like\n> format.signOff has) to the config description?\n\nI am generally in negative on automating this.  This is not just you\nbut makes everybody else's S-o-b less and less meaningful (\"Their\ntool have ways to add that string randomly, and many of these ways\nthe user ends up adding that string without even conciously thinking\nwhat they are doing.  Does that string even mean anything anymore?\").\n\nOne solution might be to make this not a straight-forward boolean,\nbut an option that superficially takes a string and treats one\nspecific value as \"true\" and everything else as \"false\", e.g.\n\n[commit]\n    signoff = \"I certify that all my work is licenseable under DCO\"\n\nI dunno.\n"},{"id":"264865","messageId":"558C2E26.1040807@telia.com","threadId":"39724","inReplyTo":"1435243807-32112-1-git-send-email-cmarcelo@gmail.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Torsten Bögershausen","fromEmail":"tboegi@telia.com","sentAt":"2015-06-25T16:36:54Z","receivedAt":"2015-06-25T16:36:54Z","isPatch":true,"sender":{"key":"tboegi@telia.com","avatar":null},"body":"On 2015-06-25 16.50, Caio Marcelo de Oliveira Filho wrote:\n\n> +test_expect_success 'commit.signoff config option' '\n> +\ttest_config commit.signoff true &&\n> +\techo \"yet another content *narf*\" >> foo &&\n\nMinor nit:\nThe > or >> should be written without a space, like this:\n>>foo\n"},{"id":"264885","messageId":"vpqvbebzket.fsf@anie.imag.fr","threadId":"39724","inReplyTo":"xmqq4mlv22we.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] commit: add commit.signoff config option","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-25T18:56:42Z","receivedAt":"2015-06-25T18:56:42Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> [commit]\n>     signoff = \"I certify that all my work is licenseable under DCO\"\n\nI like this one.\n\nThe paranoid version would be\n\n    signoff = \"I certify that all my work in /home/my/projects/foo are ...\"\n\nto avoid mistakenly have the config option applied to the wrong repo.\nBut that's probably overkill.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}