aboutsummaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2007-04-11 16:58:07 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-11 18:48:30 -0700
commit2d9e4a47d16e9d2100cc88ef6126aa7619be51ed (patch)
tree7c1b75e59767d437764b4d83ce9518402b96505a /builtin-log.c
parent566f5b217df73d6a642a0857cc5c13c11f84e7c3 (diff)
downloadgit-2d9e4a47d16e9d2100cc88ef6126aa7619be51ed.tar.gz
git-2d9e4a47d16e9d2100cc88ef6126aa7619be51ed.tar.xz
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 'builtin-log.c')
-rw-r--r--builtin-log.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 71df957ea..4a4890aca 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -417,6 +417,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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;
@@ -434,6 +435,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.ignore_merges = 1;
rev.diffopt.msg_sep = "";
rev.diffopt.recursive = 1;
+ rev.subject_prefix = "PATCH";
rev.extra_headers = extra_headers;
@@ -509,8 +511,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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];
@@ -521,6 +525,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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)