summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 566f5b2)
raw | patch | inline | side by side (parent: 566f5b2)
author | Robin H. Johnson <robbat2@gentoo.org> | |
Wed, 11 Apr 2007 23:58:07 +0000 (16:58 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 12 Apr 2007 01:48:30 +0000 (18:48 -0700) |
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>
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>
Documentation/git-format-patch.txt | patch | blob | history | |
builtin-log.c | patch | blob | history | |
log-tree.c | patch | blob | history | |
revision.h | patch | blob | history |
index 111d7c60bf1832bbfc27f8b819da77b8761236da..a33d157b970740aa7d056ebb459350de89513a8b 100644 (file)
--------
[verse]
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread]
- [--attach[=<boundary>] | --inline[=<boundary>]]
- [-s | --signoff] [<common diff options>] [--start-number <n>]
- [--in-reply-to=Message-Id] [--suffix=.<sfx>]
- [--ignore-if-in-upstream]
- <since>[..<until>]
+ [--attach[=<boundary>] | --inline[=<boundary>]]
+ [-s | --signoff] [<common diff options>] [--start-number <n>]
+ [--in-reply-to=Message-Id] [--suffix=.<sfx>]
+ [--ignore-if-in-upstream]
+ [--subject-prefix=Subject-Prefix]
+ <since>[..<until>]
DESCRIPTION
-----------
patches being generated, and any patch that matches is
ignored.
+--subject-prefix=<Subject-Prefix>::
+ Instead of the standard '[PATCH]' prefix in the subject
+ line, instead use '[<Subject-Prefix>]'. This
+ allows for useful naming of a patch series, and can be
+ combined with the --numbered option.
+
--suffix=.<sfx>::
Instead of using `.patch` as the suffix for generated
filenames, use specifed suffix. A common alternative is
diff --git a/builtin-log.c b/builtin-log.c
index 71df957eaa0b85bd841fe3758b6efbfd51243881..4a4890aca0ac085a68ca86100a5441317b5be8d4 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
int numbered = 0;
int start_number = -1;
int keep_subject = 0;
+ int subject_prefix = 0;
int ignore_if_in_upstream = 0;
int thread = 0;
const char *in_reply_to = NULL;
rev.ignore_merges = 1;
rev.diffopt.msg_sep = "";
rev.diffopt.recursive = 1;
+ rev.subject_prefix = "PATCH";
rev.extra_headers = extra_headers;
if (i == argc)
die("Need a Message-Id for --in-reply-to");
in_reply_to = argv[i];
- }
- else if (!prefixcmp(argv[i], "--suffix="))
+ } else if (!prefixcmp(argv[i], "--subject-prefix=")) {
+ subject_prefix = 1;
+ rev.subject_prefix = argv[i] + 17;
+ } else if (!prefixcmp(argv[i], "--suffix="))
fmt_patch_suffix = argv[i] + 9;
else
argv[j++] = argv[i];
start_number = 1;
if (numbered && keep_subject)
die ("-n and -k are mutually exclusive.");
+ if (keep_subject && subject_prefix)
+ die ("--subject-prefix and -k are mutually exclusive.");
argc = setup_revisions(argc, argv, &rev, "HEAD");
if (argc > 1)
diff --git a/log-tree.c b/log-tree.c
index 8797aa14c43e693c4cb64bc93dac4fe78716558d..dad551323082461c9fa1e5b9ad56a30d5cfc6343 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
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)
diff --git a/revision.h b/revision.h
index 55e6b531ce3e5838f988ca1896484333e795f192..5f3f628a9b1ec278dddc1d894066ab1278f6e473 100644 (file)
--- a/revision.h
+++ b/revision.h
const char *add_signoff;
const char *extra_headers;
const char *log_reencode;
+ const char *subject_prefix;
int no_inline;
/* Filter by commit log message */