{"thread":{"id":"8798","subject":"[PATCH] format-patch: Add format.subjectprefix config option","startedAt":"2007-07-02T00:48:59Z","lastAt":"2007-07-04T10:00:24Z","messageCount":2,"participants":["Adam Roben","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46204","messageId":"1183337339745-git-send-email-aroben@apple.com","threadId":"8798","inReplyTo":null,"subject":"[PATCH] format-patch: Add format.subjectprefix config option","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-07-02T00:48:59Z","receivedAt":"2007-07-02T00:48:59Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"This change lets you use the format.subjectprefix config option to override the\ndefault subject prefix.\n\nSigned-off-by: Adam Roben <aroben@apple.com>\n---\n Documentation/git-format-patch.txt                 |    5 +-\n builtin-log.c                                      |    9 +++\n revision.c                                         |    1 -\n t/t4013-diff-various.sh                            |    2 +\n ...ff.config_format.subjectprefix_DIFFERENT_PREFIX |    2 +\n ...ormat-patch_--inline_--stdout_initial..master^^ |   60 ++++++++++++++++++++\n 6 files changed, 76 insertions(+), 3 deletions(-)\n create mode 100644 t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX\n create mode 100644 t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 647de90..e563810 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -126,12 +126,13 @@ not add any suffix.\n CONFIGURATION\n -------------\n You can specify extra mail header lines to be added to each\n-message in the repository configuration.  Also you can specify\n-the default suffix different from the built-in one:\n+message in the repository configuration.  You can also specify\n+new defaults for the subject prefix and file suffix.\n \n ------------\n [format]\n         headers = \"Organization: git-foo\\n\"\n+        subjectprefix = CHANGE\n         suffix = .txt\n ------------\n \ndiff --git a/builtin-log.c b/builtin-log.c\nindex a4186ea..5dc2c1c 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -265,6 +265,7 @@ static int istitlechar(char c)\n \n static char *extra_headers = NULL;\n static int extra_headers_size = 0;\n+static const char *fmt_patch_subject_prefix = \"PATCH\";\n static const char *fmt_patch_suffix = \".patch\";\n \n static int git_format_config(const char *var, const char *value)\n@@ -290,6 +291,13 @@ static int git_format_config(const char *var, const char *value)\n \tif (!strcmp(var, \"diff.color\") || !strcmp(var, \"color.diff\")) {\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.subjectprefix\")) {\n+\t\tif (!value)\n+\t\t\tdie(\"format.subjectprefix without value\");\n+\t\tfmt_patch_subject_prefix = xstrdup(value);\n+\t\treturn 0;\n+\t}\n+\n \treturn git_log_config(var, value);\n }\n \n@@ -459,6 +467,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \trev.diffopt.msg_sep = \"\";\n \trev.diffopt.recursive = 1;\n \n+\trev.subject_prefix = fmt_patch_subject_prefix;\n \trev.extra_headers = extra_headers;\n \n \t/*\ndiff --git a/revision.c b/revision.c\nindex 7834bb1..5184716 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -667,7 +667,6 @@ void init_revisions(struct rev_info *revs, const char *prefix)\n \trevs->min_age = -1;\n \trevs->skip_count = -1;\n \trevs->max_count = -1;\n-\trevs->subject_prefix = \"PATCH\";\n \n \trevs->prune_fn = NULL;\n \trevs->prune_data = NULL;\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 8f4c29a..b453b42 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -242,6 +242,8 @@ format-patch --inline --stdout initial..side\n format-patch --inline --stdout initial..master^\n format-patch --inline --stdout initial..master\n format-patch --inline --stdout --subject-prefix=TESTCASE initial..master\n+config format.subjectprefix DIFFERENT_PREFIX\n+format-patch --inline --stdout initial..master^^\n \n diff --abbrev initial..side\n diff -r initial..side\ndiff --git a/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX b/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX\nnew file mode 100644\nindex 0000000..78f8970\n--- /dev/null\n+++ b/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX\n@@ -0,0 +1,2 @@\n+$ git config format.subjectprefix DIFFERENT_PREFIX\n+$\ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\nnew file mode 100644\nindex 0000000..b8e81e1\n--- /dev/null\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n@@ -0,0 +1,60 @@\n+$ git format-patch --inline --stdout initial..master^^\n+From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001\n+From: A U Thor <author@example.com>\n+Date: Mon, 26 Jun 2006 00:01:00 +0000\n+Subject: [DIFFERENT_PREFIX] Second\n+MIME-Version: 1.0\n+Content-Type: multipart/mixed; boundary=\"------------g-i-t--v-e-r-s-i-o-n\"\n+\n+This is a multi-part message in MIME format.\n+--------------g-i-t--v-e-r-s-i-o-n\n+Content-Type: text/plain; charset=UTF-8; format=fixed\n+Content-Transfer-Encoding: 8bit\n+\n+\n+This is the second commit.\n+---\n+ dir/sub |    2 ++\n+ file0   |    3 +++\n+ file2   |    3 ---\n+ 3 files changed, 5 insertions(+), 3 deletions(-)\n+ delete mode 100644 file2\n+--------------g-i-t--v-e-r-s-i-o-n\n+Content-Type: text/x-patch; name=\"1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff\"\n+Content-Transfer-Encoding: 8bit\n+Content-Disposition: inline; filename=\"1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff\"\n+\n+diff --git a/dir/sub b/dir/sub\n+index 35d242b..8422d40 100644\n+--- a/dir/sub\n++++ b/dir/sub\n+@@ -1,2 +1,4 @@\n+ A\n+ B\n++C\n++D\n+diff --git a/file0 b/file0\n+index 01e79c3..b414108 100644\n+--- a/file0\n++++ b/file0\n+@@ -1,3 +1,6 @@\n+ 1\n+ 2\n+ 3\n++4\n++5\n++6\n+diff --git a/file2 b/file2\n+deleted file mode 100644\n+index 01e79c3..0000000\n+--- a/file2\n++++ /dev/null\n+@@ -1,3 +0,0 @@\n+-1\n+-2\n+-3\n+\n+--------------g-i-t--v-e-r-s-i-o-n--\n+\n+\n+$\n-- \n1.5.2.2.619.g06f59-dirty\n"},{"id":"46459","messageId":"81b0412b0707040300q54a95b98v528bb2745c1b7eb7@mail.gmail.com","threadId":"8798","inReplyTo":"1183337339745-git-send-email-aroben@apple.com","subject":"Re: [PATCH] format-patch: Add format.subjectprefix config option","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-04T10:00:24Z","receivedAt":"2007-07-04T10:00:24Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/2/07, Adam Roben <aroben@apple.com> wrote:\n> This change lets you use the format.subjectprefix config option to override the\n> default subject prefix.\n\nIt is incomplete. The patch make git show --pretty=email produce subject\nlines like \"Subject: [(null)] ...\" because revlist argument parser\nwill not setup\nthe prefix. Besides git-show also git-log (and rev-list and maybe\nsomething else)\naccept --pretty=email option which supposed to produce the same output as\ngit-format-patch.\n"}]}