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

Re: [PATCH] qgit4: Add a header and set the font family appropriately to the log message

From
MTMichael S. Tsirkin <mst@mellanox.co.il>
Date
Feb 9, 2007, 09:19 UTC
Message-ID
<20070209091923.GT6560@mellanox.co.il>
In-Reply-To
<7vk5ysw6a3.fsf@assigned-by-dhcp.cox.net>
Show 14 quoted lines
> Quoting Junio C Hamano <junkio@cox.net>:
> Subject: Re: [PATCH] qgit4: Add a header and set the font family appropriately to the log message
> 
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > In case you did not already know, --numbered is a wonderful option
> > to git-format-patch.  It automatically numbers the commits by placing
> > a sequence into the subject header (e.g. [PATCH 1/3]), making it
> > easier for everyone to know how many patches are in your series.
> 
> This came up before, but when you have more than 9 in your
> series, we _could_ do [PATCH 01/12] ... [PATCH 12/12] to line
> them up in e-mail client of the recipients better.  Currently I
> think we do [PATCH 1/12] ... [PATCH 12/12].
Like this (lightly tested)?
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
---
diff --git a/log-tree.c b/log-tree.c
index 85acd66..6f6aa5a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -102,6 +102,14 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff)
 	return at;
 }
 
+static int get_width(unsigned nr)
+{
+	int i;
+        for (i = 1; nr > 10; ++i)
+		nr = nr / 10;
+	return i;
+}
+
 void show_log(struct rev_info *opt, const char *sep)
 {
 	static char this_header[16384];
@@ -155,8 +163,8 @@ void show_log(struct rev_info *opt, const char *sep)
 		if (opt->total > 0) {
 			static char buffer[64];
 			snprintf(buffer, sizeof(buffer),
-					"Subject: [PATCH %d/%d] ",
-					opt->nr, opt->total);
+					"Subject: [PATCH %0*d/%d] ",
+					get_width(opt->total), opt->nr, opt->total);
 			subject = buffer;
 		} else if (opt->total == 0)
 			subject = "Subject: [PATCH] ";
-- 
MST
Previous: Johannes SchindelinNext: Marco Costalba
Message 16 of 21 in “qgit: Default the log window to wider than the file list and set monospaced font”
  1. qgit: Default the log window to wider than the file list and set monospaced fontAndy Parkins, Feb 7, 2007
  2. Marco CostalbaFeb 8, 2007
  3. Jakub NarebskiFeb 8, 2007
  4. Andy ParkinsFeb 8, 2007
  5. Marco CostalbaFeb 8, 2007
  6. Andy ParkinsFeb 8, 2007
  7. Marco CostalbaFeb 8, 2007
  8. Marco CostalbaFeb 8, 2007
  9. Andy ParkinsFeb 8, 2007
  10. qgit4: Add a header and set the font family appropriately to the log messageAndy Parkins, Feb 8, 2007
  11. Shawn O. PearceFeb 8, 2007
  12. Junio C HamanoFeb 8, 2007
  13. Linus TorvaldsFeb 9, 2007
  14. format-patch -n: make sorting easier by padding numberJohannes Schindelin, Feb 9, 2007
  15. Johannes SchindelinFeb 9, 2007
  16. Michael S. TsirkinFeb 9, 2007
  17. Marco CostalbaFeb 9, 2007
  18. qgit4: Removed the monospace font override from the log viewer boxAndy Parkins, Feb 8, 2007
  19. qgit4: Set a 5:1 stretch ratio on the left and right halves of the patch viewerAndy Parkins, Feb 8, 2007
  20. Andy ParkinsFeb 8, 2007
  21. Andy ParkinsFeb 8, 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.