git-format-patch: Don't number patches when there's only one
PATCH 1/1 git-format-patch: Don't number patches when there's only one
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
--- Documentation/git-format-patch.txt | 3 ++- builtin-log.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletions(-)
Documentation/git-format-patch.txt +2 -1
@@ -56,7 +56,8 @@ 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" if the revision range to +format contains more than one commit. If given --thread, git-format-patch will generate In-Reply-To and References headers to make the second and subsequent patch mails appear
builtin-log.c +4 -0
@@ -642,6 +642,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) list[nr -1 ] = commit; } total = nr; + +/* don't number patches when there's only one */ +if (total ==1 ) + numbered =0 ;if (numbered) rev.total = total + start_number -1 ; rev.add_signoff = add_signoff;
Signature · 1 line
1.5.3.4.1273.g725c19
Hi,
Quoted 2 lines · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
Ciao,
Dscho
Quoted 7 lines · Johannes Schindelin
Hi,
Quoted 1 line · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers.
This stems from creating scripts around it where I only want to see the numbers if there is more than a single patch. Currently I can't do that without running git-format-patch twice or re-implementing the revision parsing machinery to count revisions prior to passing arguments to format-patch.
Quoted 2 lines
In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
That's sort of implicit in [PATCH], since all patch-series added by the tool I'm scripting will have [PATCH n/m], while I'd prefer for single-patches to have only [PATCH].
Quoted 2 lines
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
Would a separate option be acceptable to you?
It doesn't have to be fancy or short, since I really only mean to use it from our scripts.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Hi,
Quoted 7 lines · Andreas Ericsson
Quoted 5 lines · Johannes Schindelin
Quoted 2 lines · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
Quoted 8 lines
Quoted 2 lines
I think you should not use "-n" if you do not want to have the numbers.
This stems from creating scripts around it where I only want to see the numbers if there is more than a single patch. Currently I can't do that without running git-format-patch twice or re-implementing the revision parsing machinery to count revisions prior to passing arguments to format-patch.
Why not have something as simple as
numbered= test $(git rev-list $options | wc -l) -gt 1 && numbered=-n [...] git format-patch $numbered $options
At the moment, the semantics of "--numbered" is really clear and precise. And I really like that. It makes for less surprises.
Ciao,
Dscho
Quoted 8 lines · Johannes Schindelin
Hi,
Quoted 4 lines · Andreas Ericsson
Quoted 2 lines · Johannes Schindelin
On Sun, 21 Oct 2007, Andreas Ericsson wrote:
Quoted 9 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers.
This stems from creating scripts around it where I only want to see the numbers if there is more than a single patch. Currently I can't do that without running git-format-patch twice or re-implementing the revision parsing machinery to count revisions prior to passing arguments to format-patch.
Why not have something as simple as
numbered= test $(git rev-list $options | wc -l) -gt 1 && numbered=-n
Because 23498~12 != 23498~12..HEAD to git rev-list, but it is to
git-format-patch, meaning I'll have to duplicate the logic in every script that's supposed to use it or risk introducing a third way of specifying a list of revisions.
Quoted 6 lines
[...] git format-patch $numbered $optionsAt the moment, the semantics of "--numbered" is really clear and precise. And I really like that. It makes for less surprises.
Semantics could be equally clear for --numbered-if-multiple.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
PATCH 1/1 git-format-patch: Number patches when there are more than one
In reply to Johannes SchindelinAutomagically enable numbering if we output more than one patch.
---
Quoted 7 lines · Johannes Schindelin
Hi,
Quoted 2 lines · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
Quoted 8 lines
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Documentation/git-format-patch.txt | 3 ++- builtin-log.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-)
Documentation/git-format-patch.txt +2 -1
@@ -56,7 +56,8 @@ 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 when +there is more than one commit to prepare patches for. If given --thread, git-format-patch will generate In-Reply-To and References headers to make the second and subsequent patch mails appear
builtin-log.c +2 -0
@@ -642,6 +642,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) list[nr -1 ] = commit; } total = nr; +if (!keep_subject && total >1 ) + numbered =1 ;if (numbered) rev.total = total + start_number -1 ; rev.add_signoff = add_signoff;
Signature · 1 line
1.5.3.5
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 8 lines · Mike Hommey
Automagically enable numbering if we output more than one patch.
Signed-off-by Mike Hommey <[email protected]>---
Quoted 2 lines · Johannes Schindelin
Hi,
Quoted 9 lines
Quoted 6 lines · Andreas Ericsson
Quoted 2 lines
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Works for me. How does one turn it off?
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 17 lines · Andreas Ericsson
Quoted 16 lines · Mike Hommey
Automagically enable numbering if we output more than one patch.
Signed-off-by Mike Hommey <[email protected]>---
Quoted 12 lines · Johannes Schindelin
Hi,
Quoted 2 lines · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Works for me. How does one turn it off?
Does it make sense to turn it off ?
Mike
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 10 lines · Mike Hommey
Quoted 9 lines · Andreas Ericsson
Quoted 8 lines · Mike Hommey
Automagically enable numbering if we output more than one patch.
Signed-off-by Mike Hommey <[email protected]>---
Quoted 4 lines · Johannes Schindelin
Hi,
On Sun, 21 Oct 2007, Andreas Ericsson wrote:
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Works for me. How does one turn it off?
Does it make sense to turn it off ?
Sometimes, yes. I frequently gather several small fixes on a branch and then send all of them at once. They rarely depend on each other, and apply order is usually not important, so it doesn't make sense to order them.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Andreas" == Andreas Ericsson <[email protected]> writes:
Does it make sense to turn it off ?
Andreas> Sometimes, yes. I frequently gather several small fixes on a Andreas> branch and then send all of them at once. They rarely depend Andreas> on each other, and apply order is usually not important, so Andreas> it doesn't make sense to order them.
So do I. I prefer the auto-numbering to be off by default as it is now.
Sam
Signature · 1 line
Samuel Tardieu -- [email protected] -- http://www.rfc1149.net/
Re: [PATCH] git-format-patch: Number patches when there are more than one
In reply to Mike HommeyHi,
Quoted 19 lines · Mike Hommey
Automagically enable numbering if we output more than one patch.
Signed-off-by Mike Hommey <[email protected]>---
Quoted 13 lines · Johannes Schindelin
Hi,
Quoted 2 lines · Andreas Ericsson
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
Quoted 4 lines
Quoted 2 lines
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Still DWIDNSAA.
Ciao,
Dscho
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 14 lines · Johannes Schindelin
Hi,
Quoted 10 lines · Mike Hommey
Automagically enable numbering if we output more than one patch.
Signed-off-by Mike Hommey <[email protected]>---
Quoted 4 lines · Johannes Schindelin
Hi,
On Sun, 21 Oct 2007, Andreas Ericsson wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
[PATCH 1/1] looks a bit silly, and automagically handling this in git-format-patch makes some scripting around it a lot more pleasant.
I think you should not use "-n" if you do not want to have the numbers. In circumstances as yours, where you can have patch series larger than one, I imagine that the "[PATCH 1/1]" bears an important information, which is not present in "[PATCH]": this patch series contains only one patch.
IOW I do not like your patch: too much DWIDNS (Do What I Did NOT Say) for me.
How about the contrary ?
Still DWIDNSAA.
Every piece of DWIM can be translated as "do what I didn't say". If you had to say it, it wouldn't be DWIM after all.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Re: [PATCH] git-format-patch: Number patches when there are more than one
Hi,
Quoted 2 lines · Andreas Ericsson
Every piece of DWIM can be translated as "do what I didn't say". If you had to say it, it wouldn't be DWIM after all.
At some point, though, it becomes a "Do what _I_ (and nobody else does, or at least what a substantial part of the rest of the world did not) mean", and that point is reached here and now.
Wow. I did not think I had to explain _that_.
Ciao,
Dscho
Re: [PATCH] git-format-patch: Number patches when there are more than one
Quoted 8 lines · Johannes Schindelin
Hi,
Quoted 1 line · Andreas Ericsson
Every piece of DWIM can be translated as "do what I didn't say". If you had to say it, it wouldn't be DWIM after all.
At some point, though, it becomes a "Do what _I_ (and nobody else does, or at least what a substantial part of the rest of the world did not) mean", and that point is reached here and now.
Every piece of dwimmery is suggested by someone and usually backed by a few, so it's likely wanted by many. Your ultra-conserative "works for *me*, so shut up and stop trying to change things" means git really has to be flawless. For you, that is. For others, there are still things to improve. I'd appreciate if you could losen the "MY playpen" a little though, as it takes an awful lot of energy from the constructive discussions.
Quoted 2 lines
Wow. I did not think I had to explain _that_.
Dito.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231