format-patch: Add format.subjectprefix config option
PATCH 1/1 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 <[email protected]>
--- Documentation/git-format-patch.txt | 5 +- builtin-log.c | 9 +++ revision.c | 1 - t/t4013-diff-various.sh | 2 + ...ff.config_format.subjectprefix_DIFFERENT_PREFIX | 2 + ...ormat-patch_--inline_--stdout_initial..master^^ | 60 ++++++++++++++++++++ 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX create mode 100644 t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
Documentation/git-format-patch.txt +3 -2
@@ -126,12 +126,13 @@ not add any suffix. CONFIGURATION ------------- You can specify extra mail header lines to be added to each -message in the repository configuration. Also you can specify -the default suffix different from the built-in one: +message in the repository configuration. You can also specify +new defaults for the subject prefix and file suffix. ------------ [format] headers = "Organization: git-foo\n" + subjectprefix = CHANGE suffix = .txt ------------
builtin-log.c +9 -0
@@ -265,6 +265,7 @@ static int istitlechar(char c)static char *extra_headers =NULL ;static int extra_headers_size =0 ; +static const char *fmt_patch_subject_prefix ="PATCH" ;static const char *fmt_patch_suffix =".patch" ;static int git_format_config (const char *var,const char *value)
@@ -290,6 +291,13 @@ static int git_format_config(const char *var, const char *value)if (!strcmp (var,"diff.color" ) || !strcmp (var,"color.diff" )) {return 0 ; } +if (!strcmp (var,"format.subjectprefix" )) { +if (!value) +die ("format.subjectprefix without value" ); + fmt_patch_subject_prefix =xstrdup (value); +return 0 ; + } +return git_log_config (var, value); }
@@ -459,6 +467,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.diffopt.msg_sep ="" ; rev.diffopt.recursive =1 ; + rev.subject_prefix = fmt_patch_subject_prefix; rev.extra_headers = extra_headers;/*
revision.c +0 -1
@@ -667,7 +667,6 @@ void init_revisions(struct rev_info *revs, const char *prefix) revs->min_age =-1 ; revs->skip_count =-1 ; revs->max_count =-1 ; - revs->subject_prefix ="PATCH" ; revs->prune_fn =NULL ; revs->prune_data =NULL ;
t/t4013-diff-various.sh +2 -0
@@ -242,6 +242,8 @@ format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master +config format.subjectprefix DIFFERENT_PREFIX +format-patch --inline --stdout initial..master^^ diff --abbrev initial..side diff -r initial..side
t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX new file +2 -0
@@ -0,0 +1,2 @@ +$ git config format.subjectprefix DIFFERENT_PREFIX +$
t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
1.5.2.2.619.g06f59-dirty
Quoted 2 lines · Adam Roben
This change lets you use the format.subjectprefix config option to override the default subject prefix.
It is incomplete. The patch make git show --pretty=email produce subject lines like "Subject: [(null)] ..." because revlist argument parser will not setup
the prefix. Besides git-show also git-log (and rev-list and maybe something else)
accept --pretty=email option which supposed to produce the same output as git-format-patch.