Git fork

format-patch: Add format.subjectprefix config option

This change lets you use the format.subjectprefix config option to override the
default subject prefix.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Adam Roben and committed by
Junio C Hamano
dbd21447 05dcd698

+76 -3
+3 -2
Documentation/git-format-patch.txt
··· 126 126 CONFIGURATION 127 127 ------------- 128 128 You can specify extra mail header lines to be added to each 129 - message in the repository configuration. Also you can specify 130 - the default suffix different from the built-in one: 129 + message in the repository configuration. You can also specify 130 + new defaults for the subject prefix and file suffix. 131 131 132 132 ------------ 133 133 [format] 134 134 headers = "Organization: git-foo\n" 135 + subjectprefix = CHANGE 135 136 suffix = .txt 136 137 ------------ 137 138
+9
builtin-log.c
··· 265 265 266 266 static char *extra_headers = NULL; 267 267 static int extra_headers_size = 0; 268 + static const char *fmt_patch_subject_prefix = "PATCH"; 268 269 static const char *fmt_patch_suffix = ".patch"; 269 270 270 271 static int git_format_config(const char *var, const char *value) ··· 290 291 if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { 291 292 return 0; 292 293 } 294 + if (!strcmp(var, "format.subjectprefix")) { 295 + if (!value) 296 + die("format.subjectprefix without value"); 297 + fmt_patch_subject_prefix = xstrdup(value); 298 + return 0; 299 + } 300 + 293 301 return git_log_config(var, value); 294 302 } 295 303 ··· 459 467 rev.diffopt.msg_sep = ""; 460 468 rev.diffopt.recursive = 1; 461 469 470 + rev.subject_prefix = fmt_patch_subject_prefix; 462 471 rev.extra_headers = extra_headers; 463 472 464 473 /*
-1
revision.c
··· 667 667 revs->min_age = -1; 668 668 revs->skip_count = -1; 669 669 revs->max_count = -1; 670 - revs->subject_prefix = "PATCH"; 671 670 672 671 revs->prune_fn = NULL; 673 672 revs->prune_data = NULL;
+2
t/t4013-diff-various.sh
··· 242 242 format-patch --inline --stdout initial..master^ 243 243 format-patch --inline --stdout initial..master 244 244 format-patch --inline --stdout --subject-prefix=TESTCASE initial..master 245 + config format.subjectprefix DIFFERENT_PREFIX 246 + format-patch --inline --stdout initial..master^^ 245 247 246 248 diff --abbrev initial..side 247 249 diff -r initial..side
+2
t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX
··· 1 + $ git config format.subjectprefix DIFFERENT_PREFIX 2 + $
+60
t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
··· 1 + $ git format-patch --inline --stdout initial..master^^ 2 + From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001 3 + From: A U Thor <author@example.com> 4 + Date: Mon, 26 Jun 2006 00:01:00 +0000 5 + Subject: [DIFFERENT_PREFIX] Second 6 + MIME-Version: 1.0 7 + Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" 8 + 9 + This is a multi-part message in MIME format. 10 + --------------g-i-t--v-e-r-s-i-o-n 11 + Content-Type: text/plain; charset=UTF-8; format=fixed 12 + Content-Transfer-Encoding: 8bit 13 + 14 + 15 + This is the second commit. 16 + --- 17 + dir/sub | 2 ++ 18 + file0 | 3 +++ 19 + file2 | 3 --- 20 + 3 files changed, 5 insertions(+), 3 deletions(-) 21 + delete mode 100644 file2 22 + --------------g-i-t--v-e-r-s-i-o-n 23 + Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" 24 + Content-Transfer-Encoding: 8bit 25 + Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" 26 + 27 + diff --git a/dir/sub b/dir/sub 28 + index 35d242b..8422d40 100644 29 + --- a/dir/sub 30 + +++ b/dir/sub 31 + @@ -1,2 +1,4 @@ 32 + A 33 + B 34 + +C 35 + +D 36 + diff --git a/file0 b/file0 37 + index 01e79c3..b414108 100644 38 + --- a/file0 39 + +++ b/file0 40 + @@ -1,3 +1,6 @@ 41 + 1 42 + 2 43 + 3 44 + +4 45 + +5 46 + +6 47 + diff --git a/file2 b/file2 48 + deleted file mode 100644 49 + index 01e79c3..0000000 50 + --- a/file2 51 + +++ /dev/null 52 + @@ -1,3 +0,0 @@ 53 + -1 54 + -2 55 + -3 56 + 57 + --------------g-i-t--v-e-r-s-i-o-n-- 58 + 59 + 60 + $