# Re: [PATCH] format-patch: autonumber by default

21 messages from 2008-10-02 to 2009-11-04. Participants: Johannes Schindelin, Giuseppe Bilotta, Andreas Ericsson, Johannes Sixt, Jakub Narebski, Jeff King, Brian Gernhardt, Eric W. Biederman, Junio C Hamano.
Thread: https://gitlist.dev/t/15754

## Giuseppe Bilotta, 2008-10-02 11:27

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <1222946860-15518-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1222946860-15518-1-git-send-email-giuseppe.bilotta%40gmail.com

```
Set auto-number true by default, allowing the format.number key to be
set to 'noauto' to override this.
---
 builtin-log.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..5187dc2 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -484,6 +484,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			auto_number = 1;
 			return 0;
 		}
+		if (value && !strcasecmp(value, "noauto")) {
+			auto_number = 0;
+			return 0;
+		}
 		numbered = git_config_bool(var, value);
 		return 0;
 	}
-- 
1.5.6.5

```

## Johannes Schindelin, 2008-10-02 12:33

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <alpine.DEB.1.00.0810021433130.22125@pacific.mpi-cbg.de.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0810021433130.22125%40pacific.mpi-cbg.de.mpi-cbg.de
In-Reply-To: <1222946860-15518-1-git-send-email-giuseppe.bilotta@gmail.com>

```
Hi,

On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:

> Set auto-number true by default, allowing the format.number key to be
> set to 'noauto' to override this.
> ---
>  builtin-log.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)

Interesting.  No sign-off, no defense why this is actually desirable, 
after we lived for so long without this behavior... Care to elaborate?

Ciao,
Dscho

```

## Giuseppe Bilotta, 2008-10-02 13:10

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <cb7bb73a0810020610q657dec7clf85b4ef3575b751f@mail.gmail.com>
URL: https://gitlist.dev/e/cb7bb73a0810020610q657dec7clf85b4ef3575b751f%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0810021433130.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```
On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:
>
>> Set auto-number true by default, allowing the format.number key to be
>> set to 'noauto' to override this.
>> ---
>>  builtin-log.c |    6 +++++-
>>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> Interesting.  No sign-off, no defense why this is actually desirable,
> after we lived for so long without this behavior... Care to elaborate?

Doh, sorry about the Sign-off, I'll resend with.

Now, about the reason for this patch: I would say that the most common
use-case of format-patch being used to prepare multiple patches is
when one plans on sending a patchset. When format.numbering is set to
auto, single-patches will still be extracted without numbers, but
patchset will be properly numbered.

Of course, there may be cases where one doesn't want numbering (for
which there is the -N flag already), and of course we want to give the
user the choice to disable autonumbering at the config level, for
which there is the new noauto option for format.numbering.

If this explanation is good enough for you, I'll plop it in the resend
message too :)

-- 
Giuseppe "Oblomov" Bilotta

```

## Johannes Schindelin, 2008-10-02 13:42

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <alpine.DEB.1.00.0810021541470.22125@pacific.mpi-cbg.de.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0810021541470.22125%40pacific.mpi-cbg.de.mpi-cbg.de
In-Reply-To: <cb7bb73a0810020610q657dec7clf85b4ef3575b751f@mail.gmail.com>

```
Hi,

On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:

> On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>
> > On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:
> >
> >> Set auto-number true by default, allowing the format.number key to be
> >> set to 'noauto' to override this.
> >> ---
> >>  builtin-log.c |    6 +++++-
> >>  1 files changed, 5 insertions(+), 1 deletions(-)
> >
> > Interesting.  No sign-off, no defense why this is actually desirable,
> > after we lived for so long without this behavior... Care to elaborate?
> 
> Doh, sorry about the Sign-off, I'll resend with.
> 
> Now, about the reason for this patch: I would say that the most common
> use-case of format-patch being used to prepare multiple patches is
> when one plans on sending a patchset. When format.numbering is set to
> auto, single-patches will still be extracted without numbers, but
> patchset will be properly numbered.
> 
> Of course, there may be cases where one doesn't want numbering (for
> which there is the -N flag already), and of course we want to give the
> user the choice to disable autonumbering at the config level, for
> which there is the new noauto option for format.numbering.
> 
> If this explanation is good enough for you, I'll plop it in the resend
> message too :)

Yep, this is worthy of a commit message.

Thanks,
Dscho

```

## Andreas Ericsson, 2008-10-02 13:43

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <48E4CFED.3060903@op5.se>
URL: https://gitlist.dev/e/48E4CFED.3060903%40op5.se
In-Reply-To: <cb7bb73a0810020610q657dec7clf85b4ef3575b751f@mail.gmail.com>

```
Giuseppe Bilotta wrote:
> On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> Hi,
>>
>> On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:
>>
>>> Set auto-number true by default, allowing the format.number key to be
>>> set to 'noauto' to override this.
>>> ---
>>>  builtin-log.c |    6 +++++-
>>>  1 files changed, 5 insertions(+), 1 deletions(-)
>> Interesting.  No sign-off, no defense why this is actually desirable,
>> after we lived for so long without this behavior... Care to elaborate?
> 
> Doh, sorry about the Sign-off, I'll resend with.
> 
> Now, about the reason for this patch: I would say that the most common
> use-case of format-patch being used to prepare multiple patches is
> when one plans on sending a patchset. When format.numbering is set to
> auto, single-patches will still be extracted without numbers, but
> patchset will be properly numbered.
> 

I like it. It hasn't bitten me since I moved to imap-send, but when I
used send-email I sometimes forgot and ended up sending patch-series
without numbers.

I sent a patch for it once, but changed the default instead of making
it configurable so it got turned down.

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

```

## Giuseppe Bilotta, 2008-10-02 13:47

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <1222955278-16908-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1222955278-16908-1-git-send-email-giuseppe.bilotta%40gmail.com
In-Reply-To: <alpine.DEB.1.00.0810021541470.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```
format-patch is most commoly used for multiple patches at once when
sending a patchset, in which case we want to number the patches; on the
other hand, single-patches are not usually expected to be numbered.

The typical behavior expected by format-patch is therefore the one
obtained by enabling autonumber, which should therefore be the default.

Users that want to disable numbering for a particular patchset can do so
with the existing -N command-line switch. For users that want to change
the default behavior we provide a 'noauto' option for the
format.numbering config key.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 builtin-log.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..5187dc2 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -484,6 +484,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			auto_number = 1;
 			return 0;
 		}
+		if (value && !strcasecmp(value, "noauto")) {
+			auto_number = 0;
+			return 0;
+		}
 		numbered = git_config_bool(var, value);
 		return 0;
 	}
-- 
1.5.6.5

```

## Johannes Sixt, 2008-10-02 13:54

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <48E4D278.1000103@viscovery.net>
URL: https://gitlist.dev/e/48E4D278.1000103%40viscovery.net
In-Reply-To: <cb7bb73a0810020610q657dec7clf85b4ef3575b751f@mail.gmail.com>

```
Giuseppe Bilotta schrieb:
> Now, about the reason for this patch: I would say that the most common
> use-case of format-patch being used to prepare multiple patches is
> when one plans on sending a patchset. When format.numbering is set to
> auto, single-patches will still be extracted without numbers, but
> patchset will be properly numbered.
> 
> Of course, there may be cases where one doesn't want numbering (for
> which there is the -N flag already), and of course we want to give the
> user the choice to disable autonumbering at the config level, for
> which there is the new noauto option for format.numbering.

I recall that this has been discussed (months or years ago), but I don't
recall whether there was a conclusion or whether the change was dismissed.
Did you research the ML archives?

-- Hannes

```

## Jakub Narebski, 2008-10-02 14:08

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <200810021608.54287.jnareb@gmail.com>
URL: https://gitlist.dev/e/200810021608.54287.jnareb%40gmail.com
In-Reply-To: <1222955278-16908-1-git-send-email-giuseppe.bilotta@gmail.com>

```
Giuseppe Bilotta wrote:
> format-patch is most commoly used for multiple patches at once when

s/commoly/commonly/;

I'm not sure about 'most' there...

> sending a patchset, in which case we want to number the patches; on the
> other hand, single-patches are not usually expected to be numbered.
> 
> The typical behavior expected by format-patch is therefore the one
> obtained by enabling autonumber, which should therefore be the default.
> 
> Users that want to disable numbering for a particular patchset can do so
> with the existing -N command-line switch. For users that want to change
> the default behavior we provide a 'noauto' option for the
> format.numbering config key.

Nice. I like it.
-- 
Jakub Narebski
Poland

```

## Andreas Ericsson, 2008-10-02 14:14

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <48E4D73B.9090508@op5.se>
URL: https://gitlist.dev/e/48E4D73B.9090508%40op5.se
In-Reply-To: <200810021608.54287.jnareb@gmail.com>

```
Jakub Narebski wrote:
> Giuseppe Bilotta wrote:
>> format-patch is most commoly used for multiple patches at once when
> 
> s/commoly/commonly/;
> 
> I'm not sure about 'most' there...

In that case, just make it "often" and cut "most commoly" (sic) out.

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

```

## Giuseppe Bilotta, 2008-10-02 17:58

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <1222970291-5337-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1222970291-5337-1-git-send-email-giuseppe.bilotta%40gmail.com
In-Reply-To: <48E4D73B.9090508@op5.se>

```
format-patch is often used for multiple patches at once when sending a
patchset, in which case we want to number the patches; on the other
hand, single-patches are not usually expected to be numbered.

The typical behavior expected by format-patch is therefore the one
obtained by enabling autonumber, which should thus be the default.

Users that want to disable numbering for a particular patchset can do
so with the existing -N command-line switch. For users that want to
change the default behavior we provide a 'noauto' option for the
format.numbering config key.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 builtin-log.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..5187dc2 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -484,6 +484,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			auto_number = 1;
 			return 0;
 		}
+		if (value && !strcasecmp(value, "noauto")) {
+			auto_number = 0;
+			return 0;
+		}
 		numbered = git_config_bool(var, value);
 		return 0;
 	}
-- 
1.5.6.5

```

## Jeff King, 2008-10-02 20:03

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <20081002200333.GA29303@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081002200333.GA29303%40coredump.intra.peff.net
In-Reply-To: <1222970291-5337-1-git-send-email-giuseppe.bilotta@gmail.com>

```
On Thu, Oct 02, 2008 at 07:58:11PM +0200, Giuseppe Bilotta wrote:

> format-patch is often used for multiple patches at once when sending a
> patchset, in which case we want to number the patches; on the other
> hand, single-patches are not usually expected to be numbered.
> 
> The typical behavior expected by format-patch is therefore the one
> obtained by enabling autonumber, which should thus be the default.

I personally do not agree with this default. My usual use of
format-patch is to dump a cluster of miscellaneous patches since
"origin", and then grab the one(s) I want by title.

However, I would not be surprised to find that my use is unlike that of
most other people[1], so I am not opposed to the patch.

[1] Actually, my use has a deficiency, which is that I am often sending
2/4, without nobody having seen 1/4, on which it might actually depend.
This works in practice for me because I am often producing unrelated
janitorial patches for git. :)

So I think the goal is reasonable, but:

> ---
>  builtin-log.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)

Documentation update?

-Peff

```

## Giuseppe Bilotta, 2008-10-02 20:15

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <1222978500-5780-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1222978500-5780-1-git-send-email-giuseppe.bilotta%40gmail.com
In-Reply-To: <20081002200333.GA29303@coredump.intra.peff.net>

```
format-patch is most commoly used for multiple patches at once when
sending a patchset, in which case we want to number the patches; on the
other hand, single patches are not usually expected to be numbered.

In other words, the typical behavior expected from format-patch is the
one obtained by enabling autonumber, so we set it to be the default.

Users that want to disable numbering for a particular patchset can do so
with the existing -N command-line switch. For users that want to change
the default behavior we provide a 'noauto' option for the
format.numbering config key.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 Documentation/config.txt           |    5 +++--
 Documentation/git-format-patch.txt |    9 ++++++---
 builtin-log.c                      |    6 +++++-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index bbe38cc..9a9ed98 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -633,8 +633,9 @@ fetch.unpackLimit::
 format.numbered::
 	A boolean which can enable sequence numbers in patch subjects.
 	Setting this option to "auto" will enable it only if there is
-	more than one patch.  See --numbered option in
-	linkgit:git-format-patch[1].
+	more than one patch. This is the default behavior and can be
+	disabled by setting this option to "noauto".  See --numbered
+	option in linkgit:git-format-patch[1].
 
 format.headers::
 	Additional email headers to include in a patch to be submitted
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index adb4ea7..d7be5bb 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -59,7 +59,9 @@ If -o is specified, output files are created in <dir>.  Otherwise
 they are created in the current working directory.
 
 If -n is specified, instead of "[PATCH] Subject", the first line
-is formatted as "[PATCH n/m] Subject".
+is formatted as "[PATCH n/m] Subject". This is the default behavior
+when outputting more than one patch, and it can be suppressed with
+the -N command line option.
 
 If given --thread, 'git-format-patch' will generate In-Reply-To and
 References headers to make the second and subsequent patch mails appear
@@ -171,14 +173,15 @@ CONFIGURATION
 -------------
 You can specify extra mail header lines to be added to each message
 in the repository configuration, new defaults for the subject prefix
-and file suffix, and number patches when outputting more than one.
+and file suffix, and disable automatic numbering of patches when outputting
+more than one.
 
 ------------
 [format]
 	headers = "Organization: git-foo\n"
 	subjectprefix = CHANGE
 	suffix = .txt
-	numbered = auto
+	numbered = noauto
 	cc = <email>
 ------------
 
diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..5187dc2 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -484,6 +484,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			auto_number = 1;
 			return 0;
 		}
+		if (value && !strcasecmp(value, "noauto")) {
+			auto_number = 0;
+			return 0;
+		}
 		numbered = git_config_bool(var, value);
 		return 0;
 	}
-- 
1.5.6.5

```

## Brian Gernhardt, 2008-10-02 20:17

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <91634D16-B28A-4458-97A9-C469B5AF4E5D@silverinsanity.com>
URL: https://gitlist.dev/e/91634D16-B28A-4458-97A9-C469B5AF4E5D%40silverinsanity.com
In-Reply-To: <1222970291-5337-1-git-send-email-giuseppe.bilotta@gmail.com>

```

On Oct 2, 2008, at 1:58 PM, Giuseppe Bilotta wrote:

> diff --git a/builtin-log.c b/builtin-log.c
> index fc5e4da..5187dc2 100644
> --- a/builtin-log.c
> +++ b/builtin-log.c
> @@ -426,7 +426,7 @@ static int istitlechar(char c)
>
> static const char *fmt_patch_suffix = ".patch";
> static int numbered = 0;
> -static int auto_number = 0;
> +static int auto_number = 1;
>
> static char **extra_hdr;
> static int extra_hdr_nr;
> @@ -484,6 +484,10 @@ static int git_format_config(const char *var,  
> const char *value, void *cb)
>  			auto_number = 1;
>  			return 0;
>  		}
> +		if (value && !strcasecmp(value, "noauto")) {
> +			auto_number = 0;
> +			return 0;
> +		}
>  		numbered = git_config_bool(var, value);
>  		return 0;
>  	}

format.numbered is a tri-state config option right now: {yes, no,  
auto}.  With this patch, if you add "[format] numbered = false" into  
your config, you still get auto-numbering.

A better way to do this might be to default both numbered and  
auto_number to true and only use auto_number is numbered is true.  Or  
turn off auto-numbering when numbering is turned off just below your  
hunk.

Either way, "noauto" is a bad idea.  It's spelled "no" or "false".

~~ Brian Gernhardt

```

## Brian Gernhardt, 2008-10-02 20:36

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <1222979802-98319-1-git-send-email-benji@silverinsanity.com>
URL: https://gitlist.dev/e/1222979802-98319-1-git-send-email-benji%40silverinsanity.com
In-Reply-To: <91634D16-B28A-4458-97A9-C469B5AF4E5D@silverinsanity.com>

```
format-patch is most commonly used for multiple patches at once when
sending a patchset, in which case we want to number the patches; on
the other hand, single patches are not usually expected to be
numbered.

In other words, the typical behavior expected from format-patch is the
one obtained by enabling autonumber, so we set it to be the default.

Users that want to disable numbering for a particular patchset can do
so with the existing -N command-line switch.  Users that want to
change the default behavior can use the format.numbering config key.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---

 This is what I was talking about.  The appropriate setting to turn it off is
 "false", not "noauto".

 Documentation/config.txt           |    9 +++++----
 Documentation/git-format-patch.txt |    8 +++++---
 builtin-log.c                      |    3 ++-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index da18a54..5ba3ffa 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -640,10 +640,11 @@ fetch.unpackLimit::
 	`transfer.unpackLimit` is used instead.
 
 format.numbered::
-	A boolean which can enable sequence numbers in patch subjects.
-	Setting this option to "auto" will enable it only if there is
-	more than one patch.  See --numbered option in
-	linkgit:git-format-patch[1].
+	A boolean which can enable or disable sequence numbers in patch
+	subjects.  It defaults to "auto" which enables it only if there
+	is more than one patch.  It can be enabled or disabled for all
+	messages by setting it to "true" or "false".  See --numbered
+	option in linkgit:git-format-patch[1].
 
 format.headers::
 	Additional email headers to include in a patch to be submitted
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index adb4ea7..ac36ce8 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -58,8 +58,10 @@ output, unless the --stdout option is specified.
 If -o is specified, output files are created in <dir>.  Otherwise
 they are created in the current working directory.
 
-If -n is specified, instead of "[PATCH] Subject", the first line
-is formatted as "[PATCH n/m] Subject".
+By default, the subject of a single patch is "[PATCH] First Line" and
+the subject when multiple patches are output is "[PATCH n/m] First
+Line". To force 1/1 to be added for a single patch, use -n.  To omit
+patch numbers from the subject, use -N
 
 If given --thread, 'git-format-patch' will generate In-Reply-To and
 References headers to make the second and subsequent patch mails appear
@@ -81,7 +83,7 @@ include::diff-options.txt[]
 
 -n::
 --numbered::
-	Name output in '[PATCH n/m]' format.
+	Name output in '[PATCH n/m]' format, even with a single patch.
 
 -N::
 --no-numbered::
diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..93987ee 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -485,6 +485,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			return 0;
 		}
 		numbered = git_config_bool(var, value);
+		auto_number &&= numbered;
 		return 0;
 	}
 
-- 
1.6.0.2.589.gcd70

```

## Brian Gernhardt, 2008-10-02 20:41

Subject: [PATCH] format-patch: autonumber by default
Message-ID: <20081002204145.GA98400@Hermes>
URL: https://gitlist.dev/e/20081002204145.GA98400%40Hermes
In-Reply-To: <91634D16-B28A-4458-97A9-C469B5AF4E5D@silverinsanity.com>

```

format-patch is most commonly used for multiple patches at once when
sending a patchset, in which case we want to number the patches; on
the other hand, single patches are not usually expected to be
numbered.

In other words, the typical behavior expected from format-patch is the
one obtained by enabling autonumber, so we set it to be the default.

Users that want to disable numbering for a particular patchset can do
so with the existing -N command-line switch.  Users that want to
change the default behavior can use the format.numbering config key.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---

 This is what I was talking about.  The appropriate setting to turn it off is
 "false", not "noauto".

 Re-sending with the correct CC list.

 Documentation/config.txt           |    9 +++++----
 Documentation/git-format-patch.txt |    8 +++++---
 builtin-log.c                      |    3 ++-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index da18a54..5ba3ffa 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -640,10 +640,11 @@ fetch.unpackLimit::
 	`transfer.unpackLimit` is used instead.
 
 format.numbered::
-	A boolean which can enable sequence numbers in patch subjects.
-	Setting this option to "auto" will enable it only if there is
-	more than one patch.  See --numbered option in
-	linkgit:git-format-patch[1].
+	A boolean which can enable or disable sequence numbers in patch
+	subjects.  It defaults to "auto" which enables it only if there
+	is more than one patch.  It can be enabled or disabled for all
+	messages by setting it to "true" or "false".  See --numbered
+	option in linkgit:git-format-patch[1].
 
 format.headers::
 	Additional email headers to include in a patch to be submitted
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index adb4ea7..ac36ce8 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -58,8 +58,10 @@ output, unless the --stdout option is specified.
 If -o is specified, output files are created in <dir>.  Otherwise
 they are created in the current working directory.
 
-If -n is specified, instead of "[PATCH] Subject", the first line
-is formatted as "[PATCH n/m] Subject".
+By default, the subject of a single patch is "[PATCH] First Line" and
+the subject when multiple patches are output is "[PATCH n/m] First
+Line". To force 1/1 to be added for a single patch, use -n.  To omit
+patch numbers from the subject, use -N
 
 If given --thread, 'git-format-patch' will generate In-Reply-To and
 References headers to make the second and subsequent patch mails appear
@@ -81,7 +83,7 @@ include::diff-options.txt[]
 
 -n::
 --numbered::
-	Name output in '[PATCH n/m]' format.
+	Name output in '[PATCH n/m]' format, even with a single patch.
 
 -N::
 --no-numbered::
diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..93987ee 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -485,6 +485,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			return 0;
 		}
 		numbered = git_config_bool(var, value);
+		auto_number &&= numbered;
 		return 0;
 	}
 
-- 
1.6.0.2.589.gcd70

```

## Brian Gernhardt, 2008-10-02 20:50

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <7782583C-90DA-4D79-89FD-3550ADC52B0F@silverinsanity.com>
URL: https://gitlist.dev/e/7782583C-90DA-4D79-89FD-3550ADC52B0F%40silverinsanity.com
In-Reply-To: <20081002204145.GA98400@Hermes>

```
Okay, I should wait for my test build to finish before I send the  
patch.  This doesn't build.  Nor does it pass the tests, since they  
test the old behavior.

I'll fix the build error, but I'm not inclined to spend the time  
fixing the tests since I don't actually care about changing the default.

On Oct 2, 2008, at 4:41 PM, Brian Gernhardt wrote:

>
> format-patch is most commonly used for multiple patches at once when
> sending a patchset, in which case we want to number the patches; on
> the other hand, single patches are not usually expected to be
> numbered.
>
> In other words, the typical behavior expected from format-patch is the
> one obtained by enabling autonumber, so we set it to be the default.
>
> Users that want to disable numbering for a particular patchset can do
> so with the existing -N command-line switch.  Users that want to
> change the default behavior can use the format.numbering config key.
>
> Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
> ---
>
> This is what I was talking about.  The appropriate setting to turn  
> it off is
> "false", not "noauto".
>
> Re-sending with the correct CC list.
>
> Documentation/config.txt           |    9 +++++----
> Documentation/git-format-patch.txt |    8 +++++---
> builtin-log.c                      |    3 ++-
> 3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index da18a54..5ba3ffa 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -640,10 +640,11 @@ fetch.unpackLimit::
> 	`transfer.unpackLimit` is used instead.
>
> format.numbered::
> -	A boolean which can enable sequence numbers in patch subjects.
> -	Setting this option to "auto" will enable it only if there is
> -	more than one patch.  See --numbered option in
> -	linkgit:git-format-patch[1].
> +	A boolean which can enable or disable sequence numbers in patch
> +	subjects.  It defaults to "auto" which enables it only if there
> +	is more than one patch.  It can be enabled or disabled for all
> +	messages by setting it to "true" or "false".  See --numbered
> +	option in linkgit:git-format-patch[1].
>
> format.headers::
> 	Additional email headers to include in a patch to be submitted
> diff --git a/Documentation/git-format-patch.txt b/Documentation/git- 
> format-patch.txt
> index adb4ea7..ac36ce8 100644
> --- a/Documentation/git-format-patch.txt
> +++ b/Documentation/git-format-patch.txt
> @@ -58,8 +58,10 @@ output, unless the --stdout option is specified.
> If -o is specified, output files are created in <dir>.  Otherwise
> they are created in the current working directory.
>
> -If -n is specified, instead of "[PATCH] Subject", the first line
> -is formatted as "[PATCH n/m] Subject".
> +By default, the subject of a single patch is "[PATCH] First Line" and
> +the subject when multiple patches are output is "[PATCH n/m] First
> +Line". To force 1/1 to be added for a single patch, use -n.  To omit
> +patch numbers from the subject, use -N
>
> If given --thread, 'git-format-patch' will generate In-Reply-To and
> References headers to make the second and subsequent patch mails  
> appear
> @@ -81,7 +83,7 @@ include::diff-options.txt[]
>
> -n::
> --numbered::
> -	Name output in '[PATCH n/m]' format.
> +	Name output in '[PATCH n/m]' format, even with a single patch.
>
> -N::
> --no-numbered::
> diff --git a/builtin-log.c b/builtin-log.c
> index fc5e4da..93987ee 100644
> --- a/builtin-log.c
> +++ b/builtin-log.c
> @@ -426,7 +426,7 @@ static int istitlechar(char c)
>
> static const char *fmt_patch_suffix = ".patch";
> static int numbered = 0;
> -static int auto_number = 0;
> +static int auto_number = 1;
>
> static char **extra_hdr;
> static int extra_hdr_nr;
> @@ -485,6 +485,7 @@ static int git_format_config(const char *var,  
> const char *value, void *cb)
> 			return 0;
> 		}
> 		numbered = git_config_bool(var, value);
> +		auto_number &&= numbered;
> 		return 0;
> 	}
>
> -- 
> 1.6.0.2.589.gcd70
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Brian Gernhardt, 2008-10-02 20:55

Subject: [PATCH v2] format-patch: autonumber by default
Message-ID: <20081002205539.GA36768@Hermes>
URL: https://gitlist.dev/e/20081002205539.GA36768%40Hermes
In-Reply-To: <91634D16-B28A-4458-97A9-C469B5AF4E5D@silverinsanity.com>

```
format-patch is most commonly used for multiple patches at once when
sending a patchset, in which case we want to number the patches; on
the other hand, single patches are not usually expected to be
numbered.

In other words, the typical behavior expected from format-patch is the
one obtained by enabling autonumber, so we set it to be the default.

Users that want to disable numbering for a particular patchset can do
so with the existing -N command-line switch.  Users that want to
change the default behavior can use the format.numbering config key.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---

 _This_ patch changes the default and makes the config variable act
 properly.  Does not pass tests.  4014 and 4021 would have to be
 updated for the new defaults.

 Documentation/config.txt           |    9 +++++----
 Documentation/git-format-patch.txt |    8 +++++---
 builtin-log.c                      |    3 ++-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index da18a54..5ba3ffa 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -640,10 +640,11 @@ fetch.unpackLimit::
 	`transfer.unpackLimit` is used instead.
 
 format.numbered::
-	A boolean which can enable sequence numbers in patch subjects.
-	Setting this option to "auto" will enable it only if there is
-	more than one patch.  See --numbered option in
-	linkgit:git-format-patch[1].
+	A boolean which can enable or disable sequence numbers in patch
+	subjects.  It defaults to "auto" which enables it only if there
+	is more than one patch.  It can be enabled or disabled for all
+	messages by setting it to "true" or "false".  See --numbered
+	option in linkgit:git-format-patch[1].
 
 format.headers::
 	Additional email headers to include in a patch to be submitted
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index adb4ea7..ac36ce8 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -58,8 +58,10 @@ output, unless the --stdout option is specified.
 If -o is specified, output files are created in <dir>.  Otherwise
 they are created in the current working directory.
 
-If -n is specified, instead of "[PATCH] Subject", the first line
-is formatted as "[PATCH n/m] Subject".
+By default, the subject of a single patch is "[PATCH] First Line" and
+the subject when multiple patches are output is "[PATCH n/m] First
+Line". To force 1/1 to be added for a single patch, use -n.  To omit
+patch numbers from the subject, use -N
 
 If given --thread, 'git-format-patch' will generate In-Reply-To and
 References headers to make the second and subsequent patch mails appear
@@ -81,7 +83,7 @@ include::diff-options.txt[]
 
 -n::
 --numbered::
-	Name output in '[PATCH n/m]' format.
+	Name output in '[PATCH n/m]' format, even with a single patch.
 
 -N::
 --no-numbered::
diff --git a/builtin-log.c b/builtin-log.c
index fc5e4da..ee7c34e 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -426,7 +426,7 @@ static int istitlechar(char c)
 
 static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
-static int auto_number = 0;
+static int auto_number = 1;
 
 static char **extra_hdr;
 static int extra_hdr_nr;
@@ -485,6 +485,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
 			return 0;
 		}
 		numbered = git_config_bool(var, value);
+		auto_number = auto_number && numbered;
 		return 0;
 	}
 
-- 
1.6.0.2.589.gcd70

```

## Jeff King, 2008-10-02 21:06

Subject: Re: [PATCH] format-patch: autonumber by default
Message-ID: <20081002210611.GA29480@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081002210611.GA29480%40coredump.intra.peff.net
In-Reply-To: <1222978500-5780-1-git-send-email-giuseppe.bilotta@gmail.com>

```
On Thu, Oct 02, 2008 at 10:15:00PM +0200, Giuseppe Bilotta wrote:

>  Documentation/config.txt           |    5 +++--
>  Documentation/git-format-patch.txt |    9 ++++++---
>  builtin-log.c                      |    6 +++++-
>  3 files changed, 14 insertions(+), 6 deletions(-)

Thanks, the documentation updates look good to me. There are also some
updates required in t4013 (since the expected outputs for some instances
will now be numbered) and t4020 (which explicitly checks that the
default is no numbering). Probably t4020 should be modified in light of
the new default, like so:

---
 t/t4021-format-patch-numbered.sh |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t4021-format-patch-numbered.sh b/t/t4021-format-patch-numbered.sh
index 43d64bb..390af23 100755
--- a/t/t4021-format-patch-numbered.sh
+++ b/t/t4021-format-patch-numbered.sh
@@ -45,17 +45,22 @@ test_numbered() {
 	grep "^Subject: \[PATCH 2/2\]" $1
 }
 
-test_expect_success 'Default: no numbered' '
+test_expect_success 'single patch defaults to no numbers' '
+	git format-patch --stdout HEAD~1 >patch0.single &&
+	test_single_no_numbered patch0.single
+'
+
+test_expect_success 'multiple patch defaults to numbered' '
 
-	git format-patch --stdout HEAD~2 >patch0 &&
-	test_no_numbered patch0
+	git format-patch --stdout HEAD~2 >patch0.multiple &&
+	test_numbered patch0.multiple
 
 '
 
 test_expect_success 'Use --numbered' '
 
-	git format-patch --numbered --stdout HEAD~2 >patch1 &&
-	test_numbered patch1
+	git format-patch --numbered --stdout HEAD~1 >patch1 &&
+	test_single_numbered patch1
 
 '
 
-- 
1.6.0.2.570.g2c958

```

## Eric W. Biederman, 2009-11-04 11:20

Subject: Re: [PATCH v2] format-patch: autonumber by default
Message-ID: <m1ws261qqi.fsf@fess.ebiederm.org>
URL: https://gitlist.dev/e/m1ws261qqi.fsf%40fess.ebiederm.org
In-Reply-To: <20081002205539.GA36768@Hermes>

```

Brian Gernhardt <benji@silverinsanity.com> writes:

> format-patch is most commonly used for multiple patches at once when
> sending a patchset, in which case we want to number the patches; on
> the other hand, single patches are not usually expected to be
> numbered.
>
> In other words, the typical behavior expected from format-patch is the
> one obtained by enabling autonumber, so we set it to be the default.
>
> Users that want to disable numbering for a particular patchset can do
> so with the existing -N command-line switch.  Users that want to
> change the default behavior can use the format.numbering config key.
>
> Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
> ---


Grumble.  I updated git last night and this change just bit me.
Grumble.
Grumble.

It is probably a good change, but it was unexpected.
Grumble. Grumble. Grumble.


Eric

```

## Junio C Hamano, 2009-11-04 17:38

Subject: Re: [PATCH v2] format-patch: autonumber by default
Message-ID: <7vskcui40g.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskcui40g.fsf%40alter.siamese.dyndns.org
In-Reply-To: <m1ws261qqi.fsf@fess.ebiederm.org>

```
ebiederm@xmission.com (Eric W. Biederman) writes:

> Brian Gernhardt <benji@silverinsanity.com> writes:
>
>> format-patch is most commonly used for multiple patches at once when
>> sending a patchset, in which case we want to number the patches; on
>> the other hand, single patches are not usually expected to be
>> numbered.
>>
>> In other words, the typical behavior expected from format-patch is the
>> one obtained by enabling autonumber, so we set it to be the default.
>>
>> Users that want to disable numbering for a particular patchset can do
>> so with the existing -N command-line switch.  Users that want to
>> change the default behavior can use the format.numbering config key.
>>
>> Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
>> ---
>
>
> Grumble.  I updated git last night and this change just bit me.
> Grumble.
> Grumble.
>
> It is probably a good change, but it was unexpected.
> Grumble. Grumble. Grumble.

That change was in 1.6.1.1 or so, no?  Welcome to year 2009 ;-)

Out of curiousity, which version did you update _from_?

```

## Brian Gernhardt, 2009-11-04 17:48

Subject: Re: [PATCH v2] format-patch: autonumber by default
Message-ID: <EC82292D-1A52-4EFB-8E56-33E18A343AE0@silverinsanity.com>
URL: https://gitlist.dev/e/EC82292D-1A52-4EFB-8E56-33E18A343AE0%40silverinsanity.com
In-Reply-To: <m1ws261qqi.fsf@fess.ebiederm.org>

```

On Nov 4, 2009, at 6:20 AM, Eric W. Biederman wrote:

> Grumble.  I updated git last night and this change just bit me.
> Grumble.
> Grumble.
>
> It is probably a good change, but it was unexpected.
> Grumble. Grumble. Grumble.

The change is a year old, and mentioned in the release notes from  
1.6.1.  If you're updating from old versions of git, it can be  
extremely useful to read the release notes as we do periodically have  
changes like this.  (In the git repository, they can be found as  
Documentation/RelNotes-*.txt)

If you wish to go back to the old default for a single project, use  
`git config format.numbered false`.  If you use the --global flag, it  
will set it for you all the time.  For a single set of unrelated  
patches being output at once, use the --no-numbered (short: -N) option  
to format-patch.

Sorry it caught you unawares.  Having it auto-number seemed like the  
most useful default.

~~ Brian

```
