* [PATCH] format-patch: autonumber by default @ 2008-10-02 11:27 Giuseppe Bilotta 2008-10-02 12:33 ` Johannes Schindelin 0 siblings, 1 reply; 21+ messages in thread From: Giuseppe Bilotta @ 2008-10-02 11:27 UTC (permalink / raw) To: git; +Cc: Shawn O. Pearce, Giuseppe Bilotta 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 11:27 [PATCH] format-patch: autonumber by default Giuseppe Bilotta @ 2008-10-02 12:33 ` Johannes Schindelin 2008-10-02 13:10 ` Giuseppe Bilotta 0 siblings, 1 reply; 21+ messages in thread From: Johannes Schindelin @ 2008-10-02 12:33 UTC (permalink / raw) To: Giuseppe Bilotta; +Cc: git, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 12:33 ` Johannes Schindelin @ 2008-10-02 13:10 ` Giuseppe Bilotta 2008-10-02 13:42 ` Johannes Schindelin ` (2 more replies) 0 siblings, 3 replies; 21+ messages in thread From: Giuseppe Bilotta @ 2008-10-02 13:10 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 13:10 ` Giuseppe Bilotta @ 2008-10-02 13:42 ` Johannes Schindelin 2008-10-02 13:47 ` Giuseppe Bilotta 2008-10-02 13:43 ` [PATCH] " Andreas Ericsson 2008-10-02 13:54 ` Johannes Sixt 2 siblings, 1 reply; 21+ messages in thread From: Johannes Schindelin @ 2008-10-02 13:42 UTC (permalink / raw) To: Giuseppe Bilotta; +Cc: git, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] format-patch: autonumber by default 2008-10-02 13:42 ` Johannes Schindelin @ 2008-10-02 13:47 ` Giuseppe Bilotta 2008-10-02 14:08 ` Jakub Narebski 0 siblings, 1 reply; 21+ messages in thread From: Giuseppe Bilotta @ 2008-10-02 13:47 UTC (permalink / raw) To: git; +Cc: Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Giuseppe Bilotta 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 13:47 ` Giuseppe Bilotta @ 2008-10-02 14:08 ` Jakub Narebski 2008-10-02 14:14 ` Andreas Ericsson 0 siblings, 1 reply; 21+ messages in thread From: Jakub Narebski @ 2008-10-02 14:08 UTC (permalink / raw) To: Giuseppe Bilotta; +Cc: git, Johannes Schindelin, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 14:08 ` Jakub Narebski @ 2008-10-02 14:14 ` Andreas Ericsson 2008-10-02 17:58 ` Giuseppe Bilotta 0 siblings, 1 reply; 21+ messages in thread From: Andreas Ericsson @ 2008-10-02 14:14 UTC (permalink / raw) To: Jakub Narebski Cc: Giuseppe Bilotta, git, Johannes Schindelin, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] format-patch: autonumber by default 2008-10-02 14:14 ` Andreas Ericsson @ 2008-10-02 17:58 ` Giuseppe Bilotta 2008-10-02 20:03 ` Jeff King 2008-10-02 20:17 ` Brian Gernhardt 0 siblings, 2 replies; 21+ messages in thread From: Giuseppe Bilotta @ 2008-10-02 17:58 UTC (permalink / raw) To: git Cc: Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson, Giuseppe Bilotta 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 17:58 ` Giuseppe Bilotta @ 2008-10-02 20:03 ` Jeff King 2008-10-02 20:15 ` Giuseppe Bilotta 2008-10-02 20:17 ` Brian Gernhardt 1 sibling, 1 reply; 21+ messages in thread From: Jeff King @ 2008-10-02 20:03 UTC (permalink / raw) To: Giuseppe Bilotta Cc: git, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] format-patch: autonumber by default 2008-10-02 20:03 ` Jeff King @ 2008-10-02 20:15 ` Giuseppe Bilotta 2008-10-02 21:06 ` Jeff King 0 siblings, 1 reply; 21+ messages in thread From: Giuseppe Bilotta @ 2008-10-02 20:15 UTC (permalink / raw) To: git Cc: Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Jeff King, Giuseppe Bilotta 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 20:15 ` Giuseppe Bilotta @ 2008-10-02 21:06 ` Jeff King 0 siblings, 0 replies; 21+ messages in thread From: Jeff King @ 2008-10-02 21:06 UTC (permalink / raw) To: Giuseppe Bilotta Cc: git, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 17:58 ` Giuseppe Bilotta 2008-10-02 20:03 ` Jeff King @ 2008-10-02 20:17 ` Brian Gernhardt 2008-10-02 20:36 ` Brian Gernhardt ` (2 more replies) 1 sibling, 3 replies; 21+ messages in thread From: Brian Gernhardt @ 2008-10-02 20:17 UTC (permalink / raw) To: Giuseppe Bilotta Cc: git, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] format-patch: autonumber by default 2008-10-02 20:17 ` Brian Gernhardt @ 2008-10-02 20:36 ` Brian Gernhardt 2008-10-02 20:41 ` Brian Gernhardt 2008-10-02 20:55 ` [PATCH v2] " Brian Gernhardt 2 siblings, 0 replies; 21+ messages in thread From: Brian Gernhardt @ 2008-10-02 20:36 UTC (permalink / raw) To: Git List; +Cc: Shawn O Pearce 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] format-patch: autonumber by default 2008-10-02 20:17 ` Brian Gernhardt 2008-10-02 20:36 ` Brian Gernhardt @ 2008-10-02 20:41 ` Brian Gernhardt 2008-10-02 20:50 ` Brian Gernhardt 2008-10-02 20:55 ` [PATCH v2] " Brian Gernhardt 2 siblings, 1 reply; 21+ messages in thread From: Brian Gernhardt @ 2008-10-02 20:41 UTC (permalink / raw) To: Git List Cc: Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 20:41 ` Brian Gernhardt @ 2008-10-02 20:50 ` Brian Gernhardt 0 siblings, 0 replies; 21+ messages in thread From: Brian Gernhardt @ 2008-10-02 20:50 UTC (permalink / raw) To: Brian Gernhardt Cc: Git List, Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2] format-patch: autonumber by default 2008-10-02 20:17 ` Brian Gernhardt 2008-10-02 20:36 ` Brian Gernhardt 2008-10-02 20:41 ` Brian Gernhardt @ 2008-10-02 20:55 ` Brian Gernhardt 2009-11-04 11:20 ` Eric W. Biederman 2 siblings, 1 reply; 21+ messages in thread From: Brian Gernhardt @ 2008-10-02 20:55 UTC (permalink / raw) To: Git List Cc: Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2] format-patch: autonumber by default 2008-10-02 20:55 ` [PATCH v2] " Brian Gernhardt @ 2009-11-04 11:20 ` Eric W. Biederman 2009-11-04 17:38 ` Junio C Hamano 2009-11-04 17:48 ` Brian Gernhardt 0 siblings, 2 replies; 21+ messages in thread From: Eric W. Biederman @ 2009-11-04 11:20 UTC (permalink / raw) To: Brian Gernhardt Cc: Git List, Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] format-patch: autonumber by default 2009-11-04 11:20 ` Eric W. Biederman @ 2009-11-04 17:38 ` Junio C Hamano 2009-11-04 17:48 ` Brian Gernhardt 1 sibling, 0 replies; 21+ messages in thread From: Junio C Hamano @ 2009-11-04 17:38 UTC (permalink / raw) To: Eric W. Biederman Cc: Brian Gernhardt, Git List, Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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_? ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] format-patch: autonumber by default 2009-11-04 11:20 ` Eric W. Biederman 2009-11-04 17:38 ` Junio C Hamano @ 2009-11-04 17:48 ` Brian Gernhardt 1 sibling, 0 replies; 21+ messages in thread From: Brian Gernhardt @ 2009-11-04 17:48 UTC (permalink / raw) To: Eric W. Biederman Cc: Git List, Giuseppe Bilotta, Jakub Narebski, Johannes Schindelin, Shawn O. Pearce, Andreas Ericsson 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 13:10 ` Giuseppe Bilotta 2008-10-02 13:42 ` Johannes Schindelin @ 2008-10-02 13:43 ` Andreas Ericsson 2008-10-02 13:54 ` Johannes Sixt 2 siblings, 0 replies; 21+ messages in thread From: Andreas Ericsson @ 2008-10-02 13:43 UTC (permalink / raw) To: Giuseppe Bilotta; +Cc: Johannes Schindelin, git, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] format-patch: autonumber by default 2008-10-02 13:10 ` Giuseppe Bilotta 2008-10-02 13:42 ` Johannes Schindelin 2008-10-02 13:43 ` [PATCH] " Andreas Ericsson @ 2008-10-02 13:54 ` Johannes Sixt 2 siblings, 0 replies; 21+ messages in thread From: Johannes Sixt @ 2008-10-02 13:54 UTC (permalink / raw) To: Giuseppe Bilotta; +Cc: Johannes Schindelin, git, Shawn O. Pearce 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-11-04 17:58 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-10-02 11:27 [PATCH] format-patch: autonumber by default Giuseppe Bilotta 2008-10-02 12:33 ` Johannes Schindelin 2008-10-02 13:10 ` Giuseppe Bilotta 2008-10-02 13:42 ` Johannes Schindelin 2008-10-02 13:47 ` Giuseppe Bilotta 2008-10-02 14:08 ` Jakub Narebski 2008-10-02 14:14 ` Andreas Ericsson 2008-10-02 17:58 ` Giuseppe Bilotta 2008-10-02 20:03 ` Jeff King 2008-10-02 20:15 ` Giuseppe Bilotta 2008-10-02 21:06 ` Jeff King 2008-10-02 20:17 ` Brian Gernhardt 2008-10-02 20:36 ` Brian Gernhardt 2008-10-02 20:41 ` Brian Gernhardt 2008-10-02 20:50 ` Brian Gernhardt 2008-10-02 20:55 ` [PATCH v2] " Brian Gernhardt 2009-11-04 11:20 ` Eric W. Biederman 2009-11-04 17:38 ` Junio C Hamano 2009-11-04 17:48 ` Brian Gernhardt 2008-10-02 13:43 ` [PATCH] " Andreas Ericsson 2008-10-02 13:54 ` Johannes Sixt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).