diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2007-04-11 16:58:07 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-11 18:48:30 -0700 |
commit | 2d9e4a47d16e9d2100cc88ef6126aa7619be51ed (patch) | |
tree | 7c1b75e59767d437764b4d83ce9518402b96505a /log-tree.c | |
parent | 566f5b217df73d6a642a0857cc5c13c11f84e7c3 (diff) | |
download | git-2d9e4a47d16e9d2100cc88ef6126aa7619be51ed.tar.gz |
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>
Diffstat (limited to 'log-tree.c')
-rw-r--r-- | log-tree.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/log-tree.c b/log-tree.c index 8797aa14c4..dad5513230 100644 --- a/log-tree.c +++ b/log-tree.c @@ -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) |