git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org
Cc: Andreas Ericsson <ae@op5.se>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	spearce@spearce.org
Subject: [PATCH] git-format-patch: Number patches when there are more than one
Date: Sat,  3 Nov 2007 16:44:54 +0100	[thread overview]
Message-ID: <1194104694-12530-1-git-send-email-mh@glandium.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0710221044080.25221@racer.site>

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

  parent reply	other threads:[~2007-11-03 15:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Mike Hommey [this message]
2007-11-03 15:59     ` [PATCH] git-format-patch: Number patches when there are more than one 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194104694-12530-1-git-send-email-mh@glandium.org \
    --to=mh@glandium.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).