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

13 messages from 2009-03-31 to 2009-04-07. Participants: Heiko Voigt, Andreas Ericsson, Jeff King, Sverre Rabbelier, Junio C Hamano, Matthieu Moy.
Thread: https://gitlist.dev/t/18670

## Heiko Voigt, 2009-03-31 18:50

Subject: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <20090331185018.GD72569@macbook.lan>
URL: https://gitlist.dev/e/20090331185018.GD72569%40macbook.lan

```
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.
+
 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, 2009-03-31 19:47

Subject: Re: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <49D27359.1040703@op5.se>
URL: https://gitlist.dev/e/49D27359.1040703%40op5.se
In-Reply-To: <20090331185018.GD72569@macbook.lan>

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

```

## Jeff King, 2009-03-31 20:04

Subject: Re: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <20090331200457.GA23879@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090331200457.GA23879%40coredump.intra.peff.net
In-Reply-To: <20090331185018.GD72569@macbook.lan>

```
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, 2009-03-31 20:43

Subject: Re: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <20090331204338.GA88381@macbook.lan>
URL: https://gitlist.dev/e/20090331204338.GA88381%40macbook.lan
In-Reply-To: <20090331200457.GA23879@coredump.intra.peff.net>

```
On Tue, Mar 31, 2009 at 04:04:57PM -0400, Jeff King wrote:
> 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, 2009-04-01 10:26

Subject: Re: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <20090401102610.GC26181@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090401102610.GC26181%40coredump.intra.peff.net
In-Reply-To: <20090331204338.GA88381@macbook.lan>

```
On Tue, Mar 31, 2009 at 10:43:48PM +0200, Heiko Voigt wrote:

> 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, 2009-04-01 17:51

Subject: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <20090401175153.GA90421@macbook.lan>
URL: https://gitlist.dev/e/20090401175153.GA90421%40macbook.lan
In-Reply-To: <20090401102610.GC26181@coredump.intra.peff.net>

```
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(-)

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

```

## Heiko Voigt, 2009-04-01 17:53

Subject: Re: [PATCH] Add configuration variable for sign-off to format-patch
Message-ID: <20090401175355.GB90421@macbook.lan>
URL: https://gitlist.dev/e/20090401175355.GB90421%40macbook.lan
In-Reply-To: <49D27359.1040703@op5.se>

```
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

```

## Sverre Rabbelier, 2009-04-01 17:55

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <fabb9a1e0904011055u67b3ebfbuae15c8e23d7e5ed0@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0904011055u67b3ebfbuae15c8e23d7e5ed0%40mail.gmail.com
In-Reply-To: <20090401175153.GA90421@macbook.lan>

```
Heya,

On Wed, Apr 1, 2009 at 19:51, Heiko Voigt <hvoigt@hvoigt.net> wrote:
>  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, 2009-04-06 08:14

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <7veiw69p26.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veiw69p26.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090401175153.GA90421@macbook.lan>

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

Thanks.

```

## Andreas Ericsson, 2009-04-06 10:58

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <49D9E040.40007@op5.se>
URL: https://gitlist.dev/e/49D9E040.40007%40op5.se
In-Reply-To: <7veiw69p26.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano wrote:
> 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, 2009-04-06 11:36

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <vpqvdpi5807.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqvdpi5807.fsf%40bauges.imag.fr
In-Reply-To: <49D9E040.40007@op5.se>

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

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

-- 
Matthieu

```

## Heiko Voigt, 2009-04-06 18:09

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <20090406180925.GA466@macbook.lan>
URL: https://gitlist.dev/e/20090406180925.GA466%40macbook.lan
In-Reply-To: <vpqvdpi5807.fsf@bauges.imag.fr>

```
On Mon, Apr 06, 2009 at 01:36:24PM +0200, Matthieu Moy wrote:
> 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, 2009-04-07 07:23

Subject: Re: [PATCH v2] Add configuration variable for sign-off to format-patch
Message-ID: <20090407072327.GA5239@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090407072327.GA5239%40coredump.intra.peff.net
In-Reply-To: <49D9E040.40007@op5.se>

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

> 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

```
