summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e244cb)
raw | patch | inline | side by side (parent: 4e244cb)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Fri, 9 Feb 2007 00:43:54 +0000 (01:43 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 9 Feb 2007 01:47:38 +0000 (17:47 -0800) |
Now, when format-patch outputs more than 9 patches, the numbers
are padded accordingly. Example:
[PATCH 009/167] The 9th patch of a series of 167
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
are padded accordingly. Example:
[PATCH 009/167] The 9th patch of a series of 167
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
log-tree.c | patch | blob | history |
diff --git a/log-tree.c b/log-tree.c
index 4e3c7fd6fb1e0665d9be8ac6840ec66a4e3130fb..ac8619404797633436258dbf9d76f9f4aa323395 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
return at;
}
+static unsigned int digits_in_number(unsigned int number)
+{
+ unsigned int i = 10, result = 1;
+ while (i <= number) {
+ i *= 10;
+ result++;
+ }
+ return result;
+}
+
void show_log(struct rev_info *opt, const char *sep)
{
static char this_header[16384];
if (opt->total > 0) {
static char buffer[64];
snprintf(buffer, sizeof(buffer),
- "Subject: [PATCH %d/%d] ",
+ "Subject: [PATCH %0*d/%d] ",
+ digits_in_number(opt->total),
opt->nr, opt->total);
subject = buffer;
} else if (opt->total == 0)