зеркало из https://github.com/microsoft/git.git
format-patch -n: make sorting easier by padding number
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>
This commit is contained in:
Родитель
4e244cbc5c
Коммит
e00de24b10
13
log-tree.c
13
log-tree.c
|
@ -102,6 +102,16 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff)
|
||||||
return at;
|
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)
|
void show_log(struct rev_info *opt, const char *sep)
|
||||||
{
|
{
|
||||||
static char this_header[16384];
|
static char this_header[16384];
|
||||||
|
@ -155,7 +165,8 @@ void show_log(struct rev_info *opt, const char *sep)
|
||||||
if (opt->total > 0) {
|
if (opt->total > 0) {
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"Subject: [PATCH %d/%d] ",
|
"Subject: [PATCH %0*d/%d] ",
|
||||||
|
digits_in_number(opt->total),
|
||||||
opt->nr, opt->total);
|
opt->nr, opt->total);
|
||||||
subject = buffer;
|
subject = buffer;
|
||||||
} else if (opt->total == 0)
|
} else if (opt->total == 0)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче