* [PATCH] git-format-patch: Don't number patches when there's only one
@ 2007-10-21 8:13 Andreas Ericsson
2007-10-22 9:44 ` Johannes Schindelin
0 siblings, 1 reply; 14+ messages in thread
From: Andreas Ericsson @ 2007-10-21 8:13 UTC (permalink / raw)
To: git; +Cc: spearce
[PATCH 1/1] looks a bit silly, and automagically handling
this in git-format-patch makes some scripting around it a
lot more pleasant.
Signed-off-by: Andreas Ericsson <ae@op5.se>
---
Documentation/git-format-patch.txt | 3 ++-
builtin-log.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index c9857a2..9f16951 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -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
diff --git a/builtin-log.c b/builtin-log.c
index e8b982d..5c48f4d 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -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;
--
1.5.3.4.1273.g725c19
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Don't number patches when there's only one
2007-10-21 8:13 [PATCH] git-format-patch: Don't number patches when there's only one Andreas Ericsson
@ 2007-10-22 9:44 ` Johannes Schindelin
2007-10-22 10:14 ` Andreas Ericsson
2007-11-03 15:44 ` [PATCH] git-format-patch: Number patches when there are more than one Mike Hommey
0 siblings, 2 replies; 14+ messages in thread
From: Johannes Schindelin @ 2007-10-22 9:44 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: git, spearce
Hi,
On Sun, 21 Oct 2007, Andreas Ericsson wrote:
> [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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Don't number patches when there's only one
2007-10-22 9:44 ` Johannes Schindelin
@ 2007-10-22 10:14 ` Andreas Ericsson
2007-10-22 10:22 ` Johannes Schindelin
2007-11-03 15:44 ` [PATCH] git-format-patch: Number patches when there are more than one Mike Hommey
1 sibling, 1 reply; 14+ messages in thread
From: Andreas Ericsson @ 2007-10-22 10:14 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, spearce
Johannes Schindelin wrote:
> Hi,
>
> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>
>> [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.
> 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].
> 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.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Don't number patches when there's only one
2007-10-22 10:14 ` Andreas Ericsson
@ 2007-10-22 10:22 ` Johannes Schindelin
2007-10-22 11:13 ` Andreas Ericsson
0 siblings, 1 reply; 14+ messages in thread
From: Johannes Schindelin @ 2007-10-22 10:22 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: git, spearce
Hi,
On Mon, 22 Oct 2007, Andreas Ericsson wrote:
> Johannes Schindelin wrote:
>
> > On Sun, 21 Oct 2007, Andreas Ericsson wrote:
> >
> > > [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
[...]
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Don't number patches when there's only one
2007-10-22 10:22 ` Johannes Schindelin
@ 2007-10-22 11:13 ` Andreas Ericsson
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Ericsson @ 2007-10-22 11:13 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, spearce
Johannes Schindelin wrote:
> Hi,
>
> On Mon, 22 Oct 2007, Andreas Ericsson wrote:
>
>> Johannes Schindelin wrote:
>>
>>> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>>>
>>>> [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.
> [...]
>
> 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.
>
Semantics could be equally clear for --numbered-if-multiple.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] git-format-patch: Number patches when there are more than one
2007-10-22 9:44 ` Johannes Schindelin
2007-10-22 10:14 ` Andreas Ericsson
@ 2007-11-03 15:44 ` Mike Hommey
2007-11-03 15:59 ` Andreas Ericsson
2007-11-03 16:31 ` Johannes Schindelin
1 sibling, 2 replies; 14+ messages in thread
From: Mike Hommey @ 2007-11-03 15:44 UTC (permalink / raw)
To: git; +Cc: Andreas Ericsson, Johannes Schindelin, spearce
Automagically enable numbering if we output more than one patch.
Signed-off-by: Mike Hommey <mh@glandium.org>
---
On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
> Hi,
>
> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>
> > [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 ?
Documentation/git-format-patch.txt | 3 ++-
builtin-log.c | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index f0617ef..b77daed 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -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
diff --git a/builtin-log.c b/builtin-log.c
index 8b2bf63..640d6e7 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -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;
--
1.5.3.5
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 15:44 ` [PATCH] git-format-patch: Number patches when there are more than one Mike Hommey
@ 2007-11-03 15:59 ` Andreas Ericsson
2007-11-03 16:03 ` Mike Hommey
2007-11-03 16:31 ` Johannes Schindelin
1 sibling, 1 reply; 14+ messages in thread
From: Andreas Ericsson @ 2007-11-03 15:59 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Johannes Schindelin, spearce
Mike Hommey wrote:
> Automagically enable numbering if we output more than one patch.
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>
> On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
>> Hi,
>>
>> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>>
>>> [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?
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 15:59 ` Andreas Ericsson
@ 2007-11-03 16:03 ` Mike Hommey
2007-11-03 16:32 ` Andreas Ericsson
0 siblings, 1 reply; 14+ messages in thread
From: Mike Hommey @ 2007-11-03 16:03 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: git, Johannes Schindelin, spearce
On Sat, Nov 03, 2007 at 04:59:56PM +0100, Andreas Ericsson wrote:
> Mike Hommey wrote:
>> Automagically enable numbering if we output more than one patch.
>> Signed-off-by: Mike Hommey <mh@glandium.org>
>> ---
>> On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
>>> Hi,
>>>
>>> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>>>
>>>> [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 ?
Mike
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 15:44 ` [PATCH] git-format-patch: Number patches when there are more than one Mike Hommey
2007-11-03 15:59 ` Andreas Ericsson
@ 2007-11-03 16:31 ` Johannes Schindelin
2007-11-03 16:34 ` Andreas Ericsson
1 sibling, 1 reply; 14+ messages in thread
From: Johannes Schindelin @ 2007-11-03 16:31 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Andreas Ericsson, spearce
Hi,
On Sat, 3 Nov 2007, Mike Hommey wrote:
> Automagically enable numbering if we output more than one patch.
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>
> On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
> > Hi,
> >
> > On Sun, 21 Oct 2007, Andreas Ericsson wrote:
> >
> > > [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.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 16:03 ` Mike Hommey
@ 2007-11-03 16:32 ` Andreas Ericsson
2007-11-03 18:56 ` Samuel Tardieu
0 siblings, 1 reply; 14+ messages in thread
From: Andreas Ericsson @ 2007-11-03 16:32 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Johannes Schindelin, spearce
Mike Hommey wrote:
> On Sat, Nov 03, 2007 at 04:59:56PM +0100, Andreas Ericsson wrote:
>> Mike Hommey wrote:
>>> Automagically enable numbering if we output more than one patch.
>>> Signed-off-by: Mike Hommey <mh@glandium.org>
>>> ---
>>> On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
>>>> Hi,
>>>>
>>>> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>>>>
>>>>> [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.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 16:31 ` Johannes Schindelin
@ 2007-11-03 16:34 ` Andreas Ericsson
2007-11-04 0:25 ` Johannes Schindelin
0 siblings, 1 reply; 14+ messages in thread
From: Andreas Ericsson @ 2007-11-03 16:34 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Mike Hommey, git, spearce
Johannes Schindelin wrote:
> Hi,
>
> On Sat, 3 Nov 2007, Mike Hommey wrote:
>
>> Automagically enable numbering if we output more than one patch.
>>
>> Signed-off-by: Mike Hommey <mh@glandium.org>
>> ---
>>
>> On Mon, Oct 22, 2007 at 10:44:12AM +0100, Johannes Schindelin wrote:
>>> Hi,
>>>
>>> On Sun, 21 Oct 2007, Andreas Ericsson wrote:
>>>
>>>> [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.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 16:32 ` Andreas Ericsson
@ 2007-11-03 18:56 ` Samuel Tardieu
0 siblings, 0 replies; 14+ messages in thread
From: Samuel Tardieu @ 2007-11-03 18:56 UTC (permalink / raw)
To: git
>>>>> "Andreas" == Andreas Ericsson <ae@op5.se> 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
--
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-03 16:34 ` Andreas Ericsson
@ 2007-11-04 0:25 ` Johannes Schindelin
2007-11-04 9:49 ` Andreas Ericsson
0 siblings, 1 reply; 14+ messages in thread
From: Johannes Schindelin @ 2007-11-04 0:25 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Mike Hommey, git, spearce
Hi,
On Sat, 3 Nov 2007, Andreas Ericsson wrote:
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] git-format-patch: Number patches when there are more than one
2007-11-04 0:25 ` Johannes Schindelin
@ 2007-11-04 9:49 ` Andreas Ericsson
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Ericsson @ 2007-11-04 9:49 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Mike Hommey, git, spearce
Johannes Schindelin wrote:
> Hi,
>
> On Sat, 3 Nov 2007, Andreas Ericsson wrote:
>
>> 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.
> Wow. I did not think I had to explain _that_.
>
Dito.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-11-04 9:49 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-21 8:13 [PATCH] git-format-patch: Don't number patches when there's only one Andreas Ericsson
2007-10-22 9:44 ` Johannes Schindelin
2007-10-22 10:14 ` Andreas Ericsson
2007-10-22 10:22 ` Johannes Schindelin
2007-10-22 11:13 ` Andreas Ericsson
2007-11-03 15:44 ` [PATCH] git-format-patch: Number patches when there are more than one Mike Hommey
2007-11-03 15:59 ` Andreas Ericsson
2007-11-03 16:03 ` Mike Hommey
2007-11-03 16:32 ` Andreas Ericsson
2007-11-03 18:56 ` Samuel Tardieu
2007-11-03 16:31 ` Johannes Schindelin
2007-11-03 16:34 ` Andreas Ericsson
2007-11-04 0:25 ` Johannes Schindelin
2007-11-04 9:49 ` Andreas Ericsson
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).