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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Quoting Junio C Hamano <junkio@xxxxxxx>:
> Subject: Re: [PATCH] qgit4: Add a header and set the font family appropriately to the log message
> 
> "Shawn O. Pearce" <spearce@xxxxxxxxxxx> 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@xxxxxxxxxxxxxx>

---

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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]