Skip to contentSkip to conversation

Add configuration variable for sign-off to format-patch

PATCH In review Heiko Voigt 7 participants 13 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

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(-)
Documentation/config.txt +4 -0
index ad22cb8..ed85536 100644
@@ -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
Documentation/git-format-patch.txt +1 -0
index c2eb5fa..c25ea10 100644
@@ -197,6 +197,7 @@ more than one.
 	numbered = auto
 	cc = <email>
 	attach [ = mime-boundary-string ]
+	signoff = true
 ------------
 
 
builtin-log.c +16 -7
index c7a5772..d77b7fb 100644
@@ -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');
Signature · 1 line
1.6.2.1.424.g0b27.dirty
#1 lore raw
Quoted 3 lines · Heiko Voigt

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

#2 lore raw
Quoted 9 lines · Jeff King
Quoted 3 lines · Heiko Voigt

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.:

Quoted 6 lines

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

#3 lore raw
Quoted 5 lines · Heiko Voigt

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

#4 lore raw

PATCH v2 1/1 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.

---
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(-)
Documentation/config.txt +7 -0
index ad22cb8..27cb7f1 100644
@@ -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
Documentation/git-format-patch.txt +1 -0
index c2eb5fa..c25ea10 100644
@@ -197,6 +197,7 @@ more than one.
 	numbered = auto
 	cc = <email>
 	attach [ = mime-boundary-string ]
+	signoff = true
 ------------
 
 
builtin-log.c +16 -7
index c7a5772..d77b7fb 100644
@@ -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');
Signature · 1 line
1.6.2.1.424.g0b27.dirty
#5 lore raw

Heya,

Quoted 7 lines · Heiko Voigt

 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?

Signature · 3 lines
Cheers,

Sverre Rabbelier
#6 lore raw
In reply to Heiko Voigt
Quoted 5 lines · Heiko Voigt
Documentation/config.txt +0 -0
index ad22cb8..27cb7f1 100644

Documentation/config.txt format.thread:: · line 723

Quoted 9 lines
Documentation/config.txt +6 -0
@@ -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.

#7 lore raw
Quoted 30 lines · Junio C Hamano
Quoted 5 lines · Heiko Voigt
Documentation/config.txt +0 -0
index ad22cb8..27cb7f1 100644

Documentation/config.txt format.thread:: · line 723

Quoted 9 lines
Documentation/config.txt +6 -0
@@ -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?

Quoted 4 lines

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.

Signature · 7 lines
Andreas Ericsson                   [email protected]
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.
#8 lore raw
Quoted 10 lines · Andreas Ericsson

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.

Signature · 1 line
Matthieu
#9 lore raw
Quoted 9 lines · Matthieu Moy
Quoted 7 lines · Andreas Ericsson

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:

Quoted 7 lines
Quoted 3 lines

"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.

Quoted 2 lines

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

#10 lore raw
In reply to Andreas Ericsson
Quoted 4 lines · Andreas Ericsson

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. :)

Quoted 5 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

#11 lore raw
In reply to Heiko Voigt
Quoted 19 lines · Heiko Voigt

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.

---

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(-)
Documentation/config.txt +0 -0
index ad22cb8..ed85536 100644

Documentation/config.txt format.thread:: · line 721

Quoted 7 lines
Documentation/config.txt +4 -0
@@ -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.

Signature · 7 lines
Andreas Ericsson                   [email protected]
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.
#12 lore raw
Quoted 2 lines · Andreas Ericsson

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