[PATCH] format-patch: autonumber by default

21 messages Options
Embed this post
Permalink
1 2
Giuseppe Bilotta

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Schindelin

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

Reply Threaded More More options
Print post
Permalink
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Giuseppe Bilotta

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

Reply Threaded More More options
Print post
Permalink
On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
<[hidden email]> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Schindelin

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

Reply Threaded More More options
Print post
Permalink
Hi,

On Thu, 2 Oct 2008, Giuseppe Bilotta wrote:

> On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
> <[hidden email]> 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Ericsson

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Giuseppe Bilotta
Giuseppe Bilotta wrote:

> On Thu, Oct 2, 2008 at 2:33 PM, Johannes Schindelin
> <[hidden email]> 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                   [hidden email]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Giuseppe Bilotta

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
In reply to this post by Johannes Schindelin
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 <[hidden email]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Sixt-2

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Giuseppe Bilotta
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jakub Narebski

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Giuseppe Bilotta
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Ericsson

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

Reply Threaded More More options
Print post
Permalink
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                   [hidden email]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Giuseppe Bilotta

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff King

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

Reply Threaded More More options
Print post
Permalink
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Giuseppe Bilotta

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Gernhardt

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Giuseppe Bilotta

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Gernhardt

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
---

 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Gernhardt

[PATCH] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
In reply to this post by Brian Gernhardt

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 <[hidden email]>
---

 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 [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Gernhardt

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

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
> ---
>
> 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 [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Gernhardt

[PATCH v2] format-patch: autonumber by default

Reply Threaded More More options
Print post
Permalink
In reply to this post by Brian Gernhardt
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 <[hidden email]>
---

 _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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff King

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Giuseppe Bilotta
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric W. Biederman

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Brian Gernhardt

Brian Gernhardt <[hidden email]> 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 <[hidden email]>
> ---


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




--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Junio C Hamano

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

Reply Threaded More More options
Print post
Permalink
[hidden email] (Eric W. Biederman) writes:

> Brian Gernhardt <[hidden email]> 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 <[hidden email]>
>> ---
>
>
> 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_?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
1 2