git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-format-patch: Don't number patches when there's only one

From
Andreas Ericsson <ae@op5.se>
Date
Oct 21, 2007, 08:13 UTC
Message-ID
<20071021144637.762085BB92@nox.op5.se>

[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
Next: Johannes Schindelin
Message 1 of 14 in “git-format-patch: Don't number patches when there's only one”
  1. git-format-patch: Don't number patches when there's only oneAndreas Ericsson, Oct 21, 2007
  2. Johannes SchindelinOct 22, 2007
  3. Andreas EricssonOct 22, 2007
  4. Johannes SchindelinOct 22, 2007
  5. Andreas EricssonOct 22, 2007
  6. git-format-patch: Number patches when there are more than oneMike Hommey, Nov 3, 2007
  7. Andreas EricssonNov 3, 2007
  8. Mike HommeyNov 3, 2007
  9. Andreas EricssonNov 3, 2007
  10. Samuel TardieuNov 3, 2007
  11. Johannes SchindelinNov 3, 2007
  12. Andreas EricssonNov 3, 2007
  13. Johannes SchindelinNov 4, 2007
  14. Andreas EricssonNov 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.