Add custom subject prefix support to format-patch (take 3)

Add a new option to git-format-patch, entitled --subject-prefix that allows
control of the subject prefix '[PATCH]'. Using this option, the text 'PATCH' is
replaced with whatever input is provided to the option. This allows easily
generating patches like '[PATCH 2.6.21-rc3]' or properly numbered series like
'[-mm3 PATCH N/M]'. This patch provides the implementation and documentation.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Robin H. Johnson
2007-04-11 16:58:07 -07:00
committed by Junio C Hamano
parent 566f5b217d
commit 2d9e4a47d1
4 changed files with 31 additions and 11 deletions

View File

@ -165,14 +165,20 @@ void show_log(struct rev_info *opt, const char *sep)
if (opt->total > 0) {
static char buffer[64];
snprintf(buffer, sizeof(buffer),
"Subject: [PATCH %0*d/%d] ",
"Subject: [%s %0*d/%d] ",
opt->subject_prefix,
digits_in_number(opt->total),
opt->nr, opt->total);
subject = buffer;
} else if (opt->total == 0)
subject = "Subject: [PATCH] ";
else
} else if (opt->total == 0) {
static char buffer[256];
snprintf(buffer, sizeof(buffer),
"Subject: [%s] ",
opt->subject_prefix);
subject = buffer;
} else {
subject = "Subject: ";
}
printf("From %s Mon Sep 17 00:00:00 2001\n", sha1);
if (opt->message_id)