X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=log-tree.c;h=ac8619404797633436258dbf9d76f9f4aa323395;hb=fd2a75972e90d34bc8d4bebe1d669645557a2192;hp=85acd66df7506b383db545f61eb330e401239b4e;hpb=05b07ab9632dc233bf9eebad04256e06a8cbcb35;p=git.git diff --git a/log-tree.c b/log-tree.c index 85acd66df..ac8619404 100644 --- a/log-tree.c +++ b/log-tree.c @@ -102,6 +102,16 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff) 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]; @@ -155,7 +165,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] ", + "Subject: [PATCH %0*d/%d] ", + digits_in_number(opt->total), opt->nr, opt->total); subject = buffer; } else if (opt->total == 0) @@ -226,7 +237,8 @@ void show_log(struct rev_info *opt, const char *sep) putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n'); if (opt->reflog_info) { show_reflog_message(opt->reflog_info, - opt->commit_format == CMIT_FMT_ONELINE);; + opt->commit_format == CMIT_FMT_ONELINE, + opt->relative_date); if (opt->commit_format == CMIT_FMT_ONELINE) { printf("%s", sep); return;