threads / patch / 18670

patchAdd configuration variable for sign-off to format-patch

Subject: [PATCH] Add configuration variable for sign-off to format-patch

## tl;dr

13 messages between Mar 31, 2009 and Apr 7, 2009. Diffs are folded; open one to read it.

replies: 12people: 7as markdown or json

Heiko Voigt· Mar 31, 2009, 18:50 UTC · lore

If you regularly create patches which require a Signed-off: line you may want to make it your default to add that line. It also helps you not to forget to add the -s/--signoff switch.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
Because it happened to me twice already that I forgot to add the switch.
 Documentation/config.txt           |    4 ++++
 Documentation/git-format-patch.txt |    1 +
 builtin-log.c                      |   23 ++++++++++++++++-------
 3 files changed, 21 insertions(+), 7 deletions(-)
Show changes to 3 files +21 −7

Documentation/config.txt, Documentation/git-format-patch.txt, builtin-log.c

diff --git a/Documentation/config.txt b/Documentation/config.txt
index ad22cb8..ed85536 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -715,6 +715,10 @@ format.thread::
 	A true boolean value is the same as `shallow`, and a false
 	value disables threading.
 
+format.signoff::
+	This lets you enable the -s/--signoff option of format-patch by
+	default. It takes a boolean value.
+
 gc.aggressiveWindow::
 	The window size parameter used in the delta compression
 	algorithm used by 'git-gc --aggressive'.  This defaults
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index c2eb5fa..c25ea10 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -197,6 +197,7 @@ more than one.
 	numbered = auto
 	cc = <email>
 	attach [ = mime-boundary-string ]
+	signoff = true
 ------------
 
 
diff --git a/builtin-log.c b/builtin-log.c
index c7a5772..d77b7fb 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -465,6 +465,7 @@ static void add_header(const char *value)
 #define THREAD_SHALLOW 1
 #define THREAD_DEEP 2
 static int thread = 0;
+static int do_signoff = 0;
 
 static int git_format_config(const char *var, const char *value, void *cb)
 {
@@ -514,6 +515,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 		thread = git_config_bool(var, value) && THREAD_SHALLOW;
 		return 0;
 	}
+	if (!strcmp(var, "format.signoff")) {
+		do_signoff = git_config_bool(var, value);
+		return 0;
+	}
 
 	return git_log_config(var, value, cb);
 }
@@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		}
 		else if (!strcmp(argv[i], "--signoff") ||
 			 !strcmp(argv[i], "-s")) {
-			const char *committer;
-			const char *endpos;
-			committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
-			endpos = strchr(committer, '>');
-			if (!endpos)
-				die("bogus committer info %s", committer);
-			add_signoff = xmemdupz(committer, endpos - committer + 1);
+			do_signoff = 1;
 		}
 		else if (!strcmp(argv[i], "--attach")) {
 			rev.mime_boundary = git_version_string;
@@ -923,6 +922,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	}
 	argc = j;
 
+	if(do_signoff) {
+		const char *committer;
+		const char *endpos;
+		committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
+		endpos = strchr(committer, '>');
+		if (!endpos)
+			die("bogus committer info %s", committer);
+		add_signoff = xmemdupz(committer, endpos - committer + 1);
+	}
+
 	for (i = 0; i < extra_hdr_nr; i++) {
 		strbuf_addstr(&buf, extra_hdr[i]);
 		strbuf_addch(&buf, '\n');
-- 
1.6.2.1.424.g0b27.dirty
Andreas Ericsson· Mar 31, 2009, 19:47 UTC · re: Heiko Voigt · lore

Re: [PATCH] Add configuration variable for sign-off to format-patch

Heiko Voigt wrote:
Show 26 quoted lines
> If you regularly create patches which require a Signed-off: line you may
> want to make it your default to add that line. It also helps you not to forget
> to add the -s/--signoff switch.
> 
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
> 
> Because it happened to me twice already that I forgot to add the switch.
> 
>  Documentation/config.txt           |    4 ++++
>  Documentation/git-format-patch.txt |    1 +
>  builtin-log.c                      |   23 ++++++++++++++++-------
>  3 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index ad22cb8..ed85536 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -715,6 +715,10 @@ format.thread::
>  	A true boolean value is the same as `shallow`, and a false
>  	value disables threading.
>  
> +format.signoff::
> +	This lets you enable the -s/--signoff option of format-patch by
> +	default. It takes a boolean value.
> +

Can we please make it "formatpatch.signoff" or some such instead? Just plain "format" is a bit too generic for my taste.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Heiko Voigt· Apr 1, 2009, 17:53 UTC · re: Andreas Ericsson · lore

Re: [PATCH] Add configuration variable for sign-off to format-patch

On Tue, Mar 31, 2009 at 09:47:37PM +0200, Andreas Ericsson wrote:
> Can we please make it "formatpatch.signoff" or some such instead? Just
> plain "format" is a bit too generic for my taste.

But all options for format-patch are already beginning with format. So probably leave it like this for consistency reasons.

cheers Heiko
Jeff King· Mar 31, 2009, 20:04 UTC · re: Heiko Voigt · lore

Re: [PATCH] Add configuration variable for sign-off to format-patch

On Tue, Mar 31, 2009 at 08:50:19PM +0200, Heiko Voigt wrote:
> If you regularly create patches which require a Signed-off: line you may
> want to make it your default to add that line. It also helps you not to forget
> to add the -s/--signoff switch.

I personally have no problem with such an option, but it has been argued against before. E.g.:

  http://article.gmane.org/gmane.comp.version-control.git/32522
  http://article.gmane.org/gmane.comp.version-control.git/51780
There is also some discussion here indicating that it might be accepted:
  http://article.gmane.org/gmane.comp.version-control.git/103939
-Peff
Heiko Voigt· Mar 31, 2009, 20:43 UTC · re: Jeff King · lore

Re: [PATCH] Add configuration variable for sign-off to format-patch

On Tue, Mar 31, 2009 at 04:04:57PM -0400, Jeff King wrote:
Show 15 quoted lines
> On Tue, Mar 31, 2009 at 08:50:19PM +0200, Heiko Voigt wrote:
> 
> > If you regularly create patches which require a Signed-off: line you may
> > want to make it your default to add that line. It also helps you not to forget
> > to add the -s/--signoff switch.
> 
> I personally have no problem with such an option, but it has been argued
> against before. E.g.:
> 
>   http://article.gmane.org/gmane.comp.version-control.git/32522
>   http://article.gmane.org/gmane.comp.version-control.git/51780
> 
> There is also some discussion here indicating that it might be accepted:
> 
>   http://article.gmane.org/gmane.comp.version-control.git/103939

I see, it is of course true that you should not just sign off everything without thinking about it.

However I always read through my messages before sending them and it is way easier to delete that line than typing/copying it.

I suppose if A changes a patch which originated from B he also needs to be nice and delete that the sign-off line from B (at least initially).

I don't know but if I am preparing to send a patch and *see* my signed-off line in the message I am conscious about it! I see this more as another customization. Some people tend to forget to add the signed-off and others might tend to forget to delete it. It should be on you to find out what type you are.

cheers Heiko
Jeff King· Apr 1, 2009, 10:26 UTC · re: Heiko Voigt · lore

Re: [PATCH] Add configuration variable for sign-off to format-patch

On Tue, Mar 31, 2009 at 10:43:48PM +0200, Heiko Voigt wrote:
Show 5 quoted lines
> I see, it is of course true that you should not just sign off
> everything without thinking about it.
> 
> However I always read through my messages before sending them and it is
> way easier to delete that line than typing/copying it.

I agree. Personally, the concept of writing something that I _couldn't_ sign off on is so foreign to me that I would be very conscious of the fact, and it would be simple to remove it during the final proof-read of the patch that I do.

I think to satisfy everyone, though, you need some extra text in the documentation indicating that signing off is supposed to be conscious, and you should understand the implications of setting the variable.

-Peff
Heiko Voigt· Apr 1, 2009, 17:51 UTC · re: Jeff King · lore

[PATCH v2] Add configuration variable for sign-off to format-patch

If you regularly create patches which require a Signed-off: line you may want to make it your default to add that line. It also helps you not to forget to add the -s/--signoff switch.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
This adds a note about the purpose of the Signed-off-by: line to the
Documentation this is the interdiff:
 diff --git a/Documentation/config.txt b/Documentation/config.txt
 index 9ccc28c..27cb7f1 100644
 --- a/Documentation/config.txt
 +++ b/Documentation/config.txt
 @@ -717,7 +717,10 @@ format.thread::
  
  format.signoff::
      A boolean value which lets you enable the `-s/--signoff` option of
 -    format-patch by default.
 +    format-patch by default. *Note:* Adding the Signed-off-by: line to a
 +    patch should be a conscious act and means that you certify you have
 +    the rights to submit this work under the same open source license.
 +    Please see the 'SubmittingPatches' document for further discussion.
  
  gc.aggressiveWindow::
  	The window size parameter used in the delta compression
 Documentation/config.txt           |    7 +++++++
 Documentation/git-format-patch.txt |    1 +
 builtin-log.c                      |   23 ++++++++++++++++-------
 3 files changed, 24 insertions(+), 7 deletions(-)
Show changes to 3 files +24 −7

Documentation/config.txt, Documentation/git-format-patch.txt, builtin-log.c

diff --git a/Documentation/config.txt b/Documentation/config.txt
index ad22cb8..27cb7f1 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -715,6 +715,13 @@ format.thread::
 	A true boolean value is the same as `shallow`, and a false
 	value disables threading.
 
+format.signoff::
+    A boolean value which lets you enable the `-s/--signoff` option of
+    format-patch by default. *Note:* Adding the Signed-off-by: line to a
+    patch should be a conscious act and means that you certify you have
+    the rights to submit this work under the same open source license.
+    Please see the 'SubmittingPatches' document for further discussion.
+
 gc.aggressiveWindow::
 	The window size parameter used in the delta compression
 	algorithm used by 'git-gc --aggressive'.  This defaults
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index c2eb5fa..c25ea10 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -197,6 +197,7 @@ more than one.
 	numbered = auto
 	cc = <email>
 	attach [ = mime-boundary-string ]
+	signoff = true
 ------------
 
 
diff --git a/builtin-log.c b/builtin-log.c
index c7a5772..d77b7fb 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -465,6 +465,7 @@ static void add_header(const char *value)
 #define THREAD_SHALLOW 1
 #define THREAD_DEEP 2
 static int thread = 0;
+static int do_signoff = 0;
 
 static int git_format_config(const char *var, const char *value, void *cb)
 {
@@ -514,6 +515,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 		thread = git_config_bool(var, value) && THREAD_SHALLOW;
 		return 0;
 	}
+	if (!strcmp(var, "format.signoff")) {
+		do_signoff = git_config_bool(var, value);
+		return 0;
+	}
 
 	return git_log_config(var, value, cb);
 }
@@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		}
 		else if (!strcmp(argv[i], "--signoff") ||
 			 !strcmp(argv[i], "-s")) {
-			const char *committer;
-			const char *endpos;
-			committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
-			endpos = strchr(committer, '>');
-			if (!endpos)
-				die("bogus committer info %s", committer);
-			add_signoff = xmemdupz(committer, endpos - committer + 1);
+			do_signoff = 1;
 		}
 		else if (!strcmp(argv[i], "--attach")) {
 			rev.mime_boundary = git_version_string;
@@ -923,6 +922,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	}
 	argc = j;
 
+	if(do_signoff) {
+		const char *committer;
+		const char *endpos;
+		committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
+		endpos = strchr(committer, '>');
+		if (!endpos)
+			die("bogus committer info %s", committer);
+		add_signoff = xmemdupz(committer, endpos - committer + 1);
+	}
+
 	for (i = 0; i < extra_hdr_nr; i++) {
 		strbuf_addstr(&buf, extra_hdr[i]);
 		strbuf_addch(&buf, '\n');
-- 
1.6.2.1.424.g0b27.dirty
Sverre Rabbelier· Apr 1, 2009, 17:55 UTC · re: Heiko Voigt · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

Heya,
On Wed, Apr 1, 2009 at 19:51, Heiko Voigt <hvoigt@hvoigt.net> wrote:
Show 7 quoted lines
>  format.signoff::
>      A boolean value which lets you enable the `-s/--signoff` option of
>  -    format-patch by default.
>  +    format-patch by default. *Note:* Adding the Signed-off-by: line to a
>  +    patch should be a conscious act and means that you certify you have
>  +    the rights to submit this work under the same open source license.
>  +    Please see the 'SubmittingPatches' document for further discussion.

Which brings us to the question... what about projects that do not have such a file?

-- 
Cheers,

Sverre Rabbelier
Junio C Hamano· Apr 6, 2009, 08:14 UTC · re: Heiko Voigt · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

Heiko Voigt <hvoigt@hvoigt.net> writes:
Show 14 quoted lines
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index ad22cb8..27cb7f1 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -715,6 +715,13 @@ format.thread::
>  	A true boolean value is the same as `shallow`, and a false
>  	value disables threading.
>  
> +format.signoff::
> +    A boolean value which lets you enable the `-s/--signoff` option of
> +    format-patch by default. *Note:* Adding the Signed-off-by: line to a
> +    patch should be a conscious act and means that you certify you have
> +    the rights to submit this work under the same open source license.
> +    Please see the 'SubmittingPatches' document for further discussion.

I have a mixed feeling about this description. The existing description on the --signoff option merely talks about what it does, leaving what it means, and it is quite deliberate. If your project uses S-o-b, it may be useful. If yours doesn't, you simply just don't use it. It does not matter to _us_ as the document writer what that line means to your project.

We do want to make the reader think twice iff S-o-b is used in the reader's project with the same meaning as it means in git and the Linux kernel project, which is what the description you added is about. But should we just assume if anybody uses S-o-b convention in their project they must give it the same meaning as we give it?

The patch looks straightforward enough, and the wording we can update if somebody can come up with a better one, so I'll apply the patch to 'master' and we will go from there.

Thanks.
Andreas Ericsson· Apr 6, 2009, 10:58 UTC · re: Junio C Hamano · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

Junio C Hamano wrote:
Show 34 quoted lines
> Heiko Voigt <hvoigt@hvoigt.net> writes:
> 
>> diff --git a/Documentation/config.txt b/Documentation/config.txt
>> index ad22cb8..27cb7f1 100644
>> --- a/Documentation/config.txt
>> +++ b/Documentation/config.txt
>> @@ -715,6 +715,13 @@ format.thread::
>>  	A true boolean value is the same as `shallow`, and a false
>>  	value disables threading.
>>  
>> +format.signoff::
>> +    A boolean value which lets you enable the `-s/--signoff` option of
>> +    format-patch by default. *Note:* Adding the Signed-off-by: line to a
>> +    patch should be a conscious act and means that you certify you have
>> +    the rights to submit this work under the same open source license.
>> +    Please see the 'SubmittingPatches' document for further discussion.
> 
> I have a mixed feeling about this description.  The existing description
> on the --signoff option merely talks about what it does, leaving what it
> means, and it is quite deliberate.  If your project uses S-o-b, it may be
> useful.  If yours doesn't, you simply just don't use it.  It does not
> matter to _us_ as the document writer what that line means to your
> project.
> 
> We do want to make the reader think twice iff S-o-b is used in the
> reader's project with the same meaning as it means in git and the Linux
> kernel project, which is what the description you added is about.  But
> should we just assume if anybody uses S-o-b convention in their project
> they must give it the same meaning as we give it?
> 
> The patch looks straightforward enough, and the wording we can update if
> somebody can come up with a better one, so I'll apply the patch to
> 'master' and we will go from there.
> 

How about: "Some projects (notably the Linux kernel and git itself) put special meaning in a 'Signed-off-by' line while other's dont. Please refer to your project's documentation for appropriate behaviour."

Optionally with the following amendment:

"In general, you should refrain from signing off on a patch containing material that you're not sure can be legally spread under the project's license."

I'll whip up a patch if someone cares enough about it to say "+1" to either proposal, or make a better one.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Matthieu Moy· Apr 6, 2009, 11:36 UTC · re: Andreas Ericsson · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

Andreas Ericsson <exon@op5.com> writes:
Show 10 quoted lines
> How about:
> "Some projects (notably the Linux kernel and git itself) put special
> meaning in a 'Signed-off-by' line while other's dont. Please refer
> to your project's documentation for appropriate behaviour."
>
> Optionally with the following amendment:
>
> "In general, you should refrain from signing off on a patch containing
> material that you're not sure can be legally spread under the project's
> license."

To me, this is at least an improvement over refering to SubmittingPatches (which is targeted to Git contributors) in the documentation (targeted to Git users), yes.

Not sure whether these two sentences should come in the documentation for the config option or the command-line switch.

-- 
Matthieu
Heiko Voigt· Apr 6, 2009, 18:09 UTC · re: Matthieu Moy · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

On Mon, Apr 06, 2009 at 01:36:24PM +0200, Matthieu Moy wrote:
Show 16 quoted lines
> Andreas Ericsson <exon@op5.com> writes:
> 
> > How about:
> > "Some projects (notably the Linux kernel and git itself) put special
> > meaning in a 'Signed-off-by' line while other's dont. Please refer
> > to your project's documentation for appropriate behaviour."
> >
> > Optionally with the following amendment:
> >
> > "In general, you should refrain from signing off on a patch containing
> > material that you're not sure can be legally spread under the project's
> > license."
> 
> To me, this is at least an improvement over refering to
> SubmittingPatches (which is targeted to Git contributors) in the
> documentation (targeted to Git users), yes.
To me too. When writing I was probably too focused on Git.
> Not sure whether these two sentences should come in the documentation
> for the config option or the command-line switch.

I think you should be able to get to this note from all locations where this option is provided (+ the commit option) so maybe a link ?

cheers Heiko
Jeff King· Apr 7, 2009, 07:23 UTC · re: Andreas Ericsson · lore

Re: [PATCH v2] Add configuration variable for sign-off to format-patch

On Mon, Apr 06, 2009 at 12:58:08PM +0200, Andreas Ericsson wrote:
> How about:
> "Some projects (notably the Linux kernel and git itself) put special
> meaning in a 'Signed-off-by' line while other's dont. Please refer
> to your project's documentation for appropriate behaviour."
I think that is fine, with some typo fixups:
  s/other's/others/
  s/dont/don't/
And of course being American, I would spell it behavior. :)
Show 5 quoted lines
> Optionally with the following amendment:
>
> "In general, you should refrain from signing off on a patch containing
> material that you're not sure can be legally spread under the project's
> license."

I don't think that makes sense. That is what signing-off is about for the kernel and for git, but I don't think there is any reason another project might not want to use the convenient signoff options to mean something totally unrelated (like we use Acked-by).

-Peff

← back to recent threads