git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: git@vger.kernel.org
Cc: spearce@spearce.org
Subject: [PATCH] git-format-patch: Don't number patches when there's only one
Date: Sun, 21 Oct 2007 10:13:07 +0200	[thread overview]
Message-ID: <20071021144637.762085BB92@nox.op5.se> (raw)

[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

             reply	other threads:[~2007-10-22  7:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-21  8:13 Andreas Ericsson [this message]
2007-10-22  9:44 ` [PATCH] git-format-patch: Don't number patches when there's only one 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

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=20071021144637.762085BB92@nox.op5.se \
    --to=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).