{"thread":{"id":"63453","subject":"[PATCH] commit: Add commit.signoff configuration option","startedAt":"2025-05-13T12:20:57Z","lastAt":"2025-06-09T04:24:41Z","messageCount":14,"participants":["Chris Down","Kristoffer Haugsbakk","D. Ben Knoble","Junio C Hamano","Ben Knoble","Collin Funk"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"517941","messageId":"aCM5JY25NVPgyYRP@chrisdown.name","threadId":"63453","inReplyTo":null,"subject":"[PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-05-13T12:20:53Z","receivedAt":"2025-05-13T12:20:57Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"Introduce a new `commit.signoff` config variable that mirrors the\nbehavior of the -s/--signoff flag.\n\nWe already have prior art in format-patch with `format.signoff`; this\nbrings parity for those who don’t use a patch-based workflow but still\nrely on signoffs.\n\nRight now people who have to do this regularly often alias commit to\n`commit --signoff` in their shell, which is less than ideal -- this\nconfig option avoids having to do that.\n\nSigned-off-by: Chris Down <chris@chrisdown.name>\n---\n Documentation/signoff-option.adoc         |  4 ++++\n builtin/commit.c                          |  4 ++++\n t/t7500-commit-template-squash-signoff.sh | 10 ++++++++++\n 3 files changed, 18 insertions(+)\n\ndiff --git a/Documentation/signoff-option.adoc b/Documentation/signoff-option.adoc\nindex cddfb225d1..0055874e84 100644\n--- a/Documentation/signoff-option.adoc\n+++ b/Documentation/signoff-option.adoc\n@@ -13,6 +13,10 @@ endif::git-commit[]\n \tLinux kernel and Git projects.)  Consult the documentation or\n \tleadership of the project to which you're contributing to\n \tunderstand how the signoffs are used in that project.\n+ifdef::git-commit[]\n+\tThe `commit.signoff` configuration variable may also be used to imply\n+\t`--signoff`.\n+endif::git-commit[]\n +\n The `--no-signoff` option can be used to countermand an earlier `--signoff`\n option on the command line.\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 66bd91fd52..da98895438 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1670,6 +1670,10 @@ static int git_commit_config(const char *k, const char *v,\n \t\t\t\t\t\t\t       &is_bool);\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 \treturn git_status_config(k, v, ctx, s);\n }\ndiff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh\nindex 4dca8d97a7..03c20dcb1d 100755\n--- a/t/t7500-commit-template-squash-signoff.sh\n+++ b/t/t7500-commit-template-squash-signoff.sh\n@@ -181,6 +181,16 @@ test_expect_success '--signoff' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'config commit.signoff implies signoff' '\n+\tgit config commit.signoff true &&\n+\techo \"871119\" >> bar &&\n+\tgit add bar &&\n+\techo \"zort\" | git commit -F - bar &&\n+\tgit cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n+\ttest_cmp expect output &&\n+\tgit config --unset commit.signoff\n+'\n+\n test_expect_success 'commit message from file (1)' '\n \tmkdir subdir &&\n \techo \"Log in top directory\" >log &&\n-- \n2.49.0\n\n"},{"id":"517943","messageId":"1ce39577-13d6-4666-b341-920b17f2089c@app.fastmail.com","threadId":"63453","inReplyTo":"aCM5JY25NVPgyYRP@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-05-13T13:12:08Z","receivedAt":"2025-05-13T13:12:30Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"Previous discussion: https://lore.kernel.org/git/ac87b389-2bf8-4c2e-aecd-9e86f65ca8c1@gmail.com/\n\n-- \nKristoffer Haugsbakk\n\n"},{"id":"517983","messageId":"CALnO6CBdhYFsDN=HPo9HbKeoZH7bb=xVVXUCK7nUdadLg-U_Pw@mail.gmail.com","threadId":"63453","inReplyTo":"aCM5JY25NVPgyYRP@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-05-13T21:09:40Z","receivedAt":"2025-05-13T21:09:52Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"On Tue, May 13, 2025 at 8:21 AM Chris Down <chris@chrisdown.name> wrote:\n>\n> Introduce a new `commit.signoff` config variable that mirrors the\n> behavior of the -s/--signoff flag.\n>\n> We already have prior art in format-patch with `format.signoff`; this\n> brings parity for those who don’t use a patch-based workflow but still\n> rely on signoffs.\n>\n> Right now people who have to do this regularly often alias commit to\n> `commit --signoff` in their shell, which is less than ideal -- this\n> config option avoids having to do that.\n\nIt would probably be nice to say why this makes sense in light of\npreviously-raised objections, too [1].\n\n[1]: https://lore.kernel.org/git/xmqqo6x4p6z2.fsf@gitster.g/\n\n>\n> Signed-off-by: Chris Down <chris@chrisdown.name>\n> ---\n>  Documentation/signoff-option.adoc         |  4 ++++\n>  builtin/commit.c                          |  4 ++++\n>  t/t7500-commit-template-squash-signoff.sh | 10 ++++++++++\n>  3 files changed, 18 insertions(+)\n>\n> diff --git a/Documentation/signoff-option.adoc b/Documentation/signoff-option.adoc\n> index cddfb225d1..0055874e84 100644\n> --- a/Documentation/signoff-option.adoc\n> +++ b/Documentation/signoff-option.adoc\n> @@ -13,6 +13,10 @@ endif::git-commit[]\n>         Linux kernel and Git projects.)  Consult the documentation or\n>         leadership of the project to which you're contributing to\n>         understand how the signoffs are used in that project.\n> +ifdef::git-commit[]\n> +       The `commit.signoff` configuration variable may also be used to imply\n> +       `--signoff`.\n> +endif::git-commit[]\n>  +\n>  The `--no-signoff` option can be used to countermand an earlier `--signoff`\n>  option on the command line.\n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index 66bd91fd52..da98895438 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -1670,6 +1670,10 @@ static int git_commit_config(const char *k, const char *v,\n>                                                                &is_bool);\n>                 return 0;\n>         }\n> +       if (!strcmp(k, \"commit.signoff\")) {\n> +               signoff = git_config_bool(k, v);\n> +               return 0;\n> +       }\n>\n>         return git_status_config(k, v, ctx, s);\n>  }\n> diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh\n> index 4dca8d97a7..03c20dcb1d 100755\n> --- a/t/t7500-commit-template-squash-signoff.sh\n> +++ b/t/t7500-commit-template-squash-signoff.sh\n> @@ -181,6 +181,16 @@ test_expect_success '--signoff' '\n>         test_cmp expect output\n>  '\n>\n> +test_expect_success 'config commit.signoff implies signoff' '\n> +       git config commit.signoff true &&\n\nThis should use test_config, I think. Otherwise, the config will stick\naround if the test fails. You /could/ use test_when_finished, but\ntest_config sets that up for you.\n\n> +       echo \"871119\" >> bar &&\n> +       git add bar &&\n> +       echo \"zort\" | git commit -F - bar &&\n> +       git cat-file commit HEAD | sed \"1,/^\\$/d\" > output &&\n> +       test_cmp expect output &&\n\nTook me a bit to realize (since it doesn't show in the context);\n\"expect\" is setup outside the previous signoff test and then (re)used\nhere. Reasonable, but we now have commit_msg_is in this test script.\nPerhaps worth a quick refactor patch preceding this one to make it use\nthat function? Probably not required, though?\n\n> +       git config --unset commit.signoff\n> +'\n> +\n>  test_expect_success 'commit message from file (1)' '\n>         mkdir subdir &&\n>         echo \"Log in top directory\" >log &&\n> --\n> 2.49.0\n>\n>\n\n\n-- \nD. Ben Knoble\n"},{"id":"518056","messageId":"aCTI7VjK5QMht3ws@chrisdown.name","threadId":"63453","inReplyTo":"CALnO6CBdhYFsDN=HPo9HbKeoZH7bb=xVVXUCK7nUdadLg-U_Pw@mail.gmail.com","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-05-14T16:46:37Z","receivedAt":"2025-05-14T16:46:40Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"[Code changes acked, thank you for the review :-)]\n\nD. Ben Knoble writes:\n>It would probably be nice to say why this makes sense in light of\n>previously-raised objections, too [1].\n>\n>[1]: https://lore.kernel.org/git/xmqqo6x4p6z2.fsf@gitster.g/\n\nI understand where people are coming from for sure, but I think the \nconversation has moved on beyond many of those points, right? For example, some \nof the objections are about format.signoff in 2006, but we merged that into the \ntree since 2009 in commit 1d1876e9300c (\"Add configuration variable for \nsign-off to format-patch\").\n\n From those threads, the main arguments seem to be:\n\n- Signoff should be a conscious act\n- Adding it automatically might dilute its meaning\n- The potential for signoffs through inertia without proper intent\n\nHowever, I think these objections don't hold up well in light of a few things.\n\nFirst, the objections conflict with precedent from the now merged \nformat.signoff. If we've already determined that configuring automatic signoffs \nin one context is acceptable (where that will then later become a commit \nanyway), it creates inconsistency to reject the same capability in another \nclosely related context.\n\nSecond, setting a configuration value _is_ a conscious act. When I enable \ncommit.signoff=true in a repository, I'm making a deliberate, repository \nspecific declaration that I have the rights to submit all work in this \nrepository under the project's license. This is arguably even more meaningful \nthan mechanically adding -s to individual commits, either without thought \nthrough muscle memory, or through a shell based, context agnostic alias as many \nusers do now.\n\nIn general, it feels like an inconsistency in semantics to have format.signoff \navailable but not commit.signoff. From a user's perspective, we're just adding \na signoff trailer to something that will eventually become an upstream commit.  \nIt doesn't really matter whether that's through a mailing list (format-patch), \na pull request (commit), or otherwise.\n\nI'm certainly open to further discussion, of course, but the existing precedent \nseems to make a compelling case for this feature.\n"},{"id":"518079","messageId":"xmqqy0uy4thk.fsf@gitster.g","threadId":"63453","inReplyTo":"aCTI7VjK5QMht3ws@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-05-15T00:17:59Z","receivedAt":"2025-05-15T00:18:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Down <chris@chrisdown.name> writes:\n\n> ... For\n> example, some of the objections are about format.signoff in 2006, but\n> we merged that into the tree since 2009 in commit 1d1876e9300c (\"Add\n> configuration variable for sign-off to format-patch\").\n\nBut an old mistake is never an excuse that we can pile more mistakes\nof the same kind on top.  Otherwise we wouldn't have learned anything.\n"},{"id":"518135","messageId":"aCXqqj6gKc7-fjoF@chrisdown.name","threadId":"63453","inReplyTo":"xmqqy0uy4thk.fsf@gitster.g","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-05-15T13:22:50Z","receivedAt":"2025-05-15T13:22:54Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"Junio C Hamano writes:\n>But an old mistake is never an excuse that we can pile more mistakes\n>of the same kind on top.  Otherwise we wouldn't have learned anything.\n\nI'm curious about what specific issues format.signoff has caused that make you \nconsider it a mistake. Has there been evidence over the past 16 years of it \nundermining the significance of signoffs or creating other problems?\n"},{"id":"518232","messageId":"167ABBF2-8DFB-4F1B-B5AA-93024FE8CA9C@gmail.com","threadId":"63453","inReplyTo":"aCTI7VjK5QMht3ws@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-05-16T11:50:07Z","receivedAt":"2025-05-16T11:50:32Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 14 mai 2025 à 12:46, Chris Down <chris@chrisdown.name> a écrit :\n> \n> I understand where people are coming from for sure, but I think the conversation has moved on beyond many of those points, right? For example, some of the objections are about format.signoff in 2006, but we merged that into the tree since 2009 in commit 1d1876e9300c (\"Add configuration variable for sign-off to format-patch\").\n\nJust in case it wasn’t clear: I think the patch is reasonable ;) I only meant that Junio had provided some background material that should probably be addressed, and now you have. Thanks!"},{"id":"518235","messageId":"xmqqldqwya5p.fsf@gitster.g","threadId":"63453","inReplyTo":"aCXqqj6gKc7-fjoF@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-05-16T13:09:38Z","receivedAt":"2025-05-16T13:09:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Down <chris@chrisdown.name> writes:\n\n> Junio C Hamano writes:\n>>But an old mistake is never an excuse that we can pile more mistakes\n>>of the same kind on top.  Otherwise we wouldn't have learned anything.\n>\n> I'm curious about what specific issues format.signoff has caused that\n> make you consider it a mistake. Has there been evidence over the past\n> 16 years of it undermining the significance of signoffs or creating\n> other problems?\n\nRegarding other problems, the fact that we are having this\ndiscussion is indication enough, isn't it?  If it didn't exist, we\nwouldn't have had folks who used it as an excuse to promote\ncommit.signoff in the first place.\n"},{"id":"518242","messageId":"aCdLe_W4wg8q4pkx@chrisdown.name","threadId":"63453","inReplyTo":"167ABBF2-8DFB-4F1B-B5AA-93024FE8CA9C@gmail.com","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-05-16T14:28:11Z","receivedAt":"2025-05-16T14:28:15Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"Ben Knoble writes:\n>Just in case it wasn’t clear: I think the patch is reasonable ;) I only meant \n>that Junio had provided some background material that should probably be \n>addressed, and now you have. Thanks!\n\nI didn't think that at all :-) I thought it was really helpful that you pointed \nthese out, thank you.\n"},{"id":"518251","messageId":"aCdT-UQtaaTQ8gyD@chrisdown.name","threadId":"63453","inReplyTo":"xmqqldqwya5p.fsf@gitster.g","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-05-16T15:04:25Z","receivedAt":"2025-05-16T15:04:29Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"Junio C Hamano writes:\n>Regarding other problems, the fact that we are having this\n>discussion is indication enough, isn't it?  If it didn't exist, we\n>wouldn't have had folks who used it as an excuse to promote\n>commit.signoff in the first place.\n\nI definitely understand your concern about diluting the meaning of signoffs.  \nWhat separates this patch is that it's not suggesting a config option out of \nfeature parity, but because enabling commit.signoff is itself a deliberate, \nrepository specific certification, which is arguably more meaningful than \nhabitually typing -s for each commit or using a global shell alias.\n\nThe repository specificity is particularly important here. Currently users work \naround this with shell aliases, which are global rather than scoped to a \nrepository, making commit.signoff in practice a more precise mechanism for \nexpressing their intent about what to certify.\n\nWould strengthening the documentation to emphasise that setting commit.signoff \nis a deliberate, repository-specific certification address your concern about \ndiluting the meaning of signoffs?\n"},{"id":"519541","messageId":"aD6cJxFXdGfN2XGc@chrisdown.name","threadId":"63453","inReplyTo":"aCdT-UQtaaTQ8gyD@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-06-03T06:54:31Z","receivedAt":"2025-06-03T06:54:33Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"Hi Junio,\n\nI wanted to follow up on the point around repository specificity, since that \nseems pretty key to the discussion here.\n\nLooking at public dotfiles, many users already work around this with global \nshell aliases for \"commit --signoff\". This creates the exact problem (I \nbelieve?) you're concerned about: casual, low intent signoffs without \ndeliberate per-repository intent to certify anything.\n\nA repository specific commit.signoff would be more precise than the current \nworkarounds, since it would require explicit configuration per repository \nrather than blanket global behavior or muscle memory.\n\nWould only allowing using this flag in a repository context (and not the global \ngit config) allay your concerns?\n\nThanks,\n\nChris\n"},{"id":"519664","messageId":"xmqq4iwvfx8s.fsf@gitster.g","threadId":"63453","inReplyTo":"aD6cJxFXdGfN2XGc@chrisdown.name","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-06-04T13:32:35Z","receivedAt":"2025-06-04T13:32:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Down <chris@chrisdown.name> writes:\n\n> Looking at public dotfiles, many users already work around this with\n> global shell aliases for \"commit --signoff\". This creates the exact\n> problem\n\nUsers conciously using a general customization mechanism to express\nspecific intent like the above is one thing.  Project giving users a\ntool that is specifically designed to casually set and forget before\neven understanding the implications is another.\n\nSo no, anything that specifically targets commit.signoff would not\nfall into the same category as end-users creating aliases for\nthemselves to use, I would have to say.  And we do not want to give\nan impression that we give tools specifically designed to encourage\nusers making casual sign-offs.\n\n"},{"id":"519706","messageId":"87wm9rklir.fsf@gmail.com","threadId":"63453","inReplyTo":"xmqq4iwvfx8s.fsf@gitster.g","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Collin Funk","fromEmail":"collin.funk1@gmail.com","sentAt":"2025-06-05T01:46:52Z","receivedAt":"2025-06-05T01:46:55Z","isPatch":true,"sender":{"key":"collin.funk1@gmail.com","avatar":"https://avatars.githubusercontent.com/u/65689063?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Chris Down <chris@chrisdown.name> writes:\n>\n>> Looking at public dotfiles, many users already work around this with\n>> global shell aliases for \"commit --signoff\". This creates the exact\n>> problem\n>\n> Users conciously using a general customization mechanism to express\n> specific intent like the above is one thing.  Project giving users a\n> tool that is specifically designed to casually set and forget before\n> even understanding the implications is another.\n>\n> So no, anything that specifically targets commit.signoff would not\n> fall into the same category as end-users creating aliases for\n> themselves to use, I would have to say.  And we do not want to give\n> an impression that we give tools specifically designed to encourage\n> users making casual sign-offs.\n\nI agree.\n\nAlthough the FSF copyright assignment needed to contribute to some GNU\nprojects is time-consuming, it forces the contributor to consider \"Do I\nown the rights to the code I create?\" This isn't the case in many US\nstates if you are an exempt employee, which most Software Developers\nare.\n\nSimilarly, when you sign-off to the DCO you also acknowledge that you\nhave the rights to license your work under the projects license. By\nadding this option, I worry that contributors will just configure it\nglobally as a prerequisite to their work being accepted, and not\nconsider whether they are even allowed to make the contribution in the\nfirst place.\n\nCollin\n"},{"id":"519948","messageId":"aEZiB--73TnO8rxX@chrisdown.name","threadId":"63453","inReplyTo":"xmqq4iwvfx8s.fsf@gitster.g","subject":"Re: [PATCH] commit: Add commit.signoff configuration option","fromName":"Chris Down","fromEmail":"chris@chrisdown.name","sentAt":"2025-06-09T04:24:39Z","receivedAt":"2025-06-09T04:24:41Z","isPatch":true,"sender":{"key":"chris@chrisdown.name","avatar":"https://avatars.githubusercontent.com/u/660663?v=4"},"body":"That's fair enough. Thanks for taking the time to discuss it. :-)\n"}]}