summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-03-01 11:37:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-01 23:09:17 (GMT)
commit6d167fd7ccb84f07a0bd57d8e188a651e913b158 (patch)
tree73b2ac5bf9dd492b1b8112ababde2c2e16caac84 /log-tree.c
parent8ffc8dc6bab4cf3d2364dd54b2de6c3afdb48610 (diff)
downloadgit-6d167fd7ccb84f07a0bd57d8e188a651e913b158.zip
git-6d167fd7ccb84f07a0bd57d8e188a651e913b158.tar.gz
git-6d167fd7ccb84f07a0bd57d8e188a651e913b158.tar.bz2
pretty: use fmt_output_email_subject()
Add the email-style subject prefix (e.g. "Subject: [PATCH] ") directly when it's needed instead of letting log_write_email_headers() prepare it in a static buffer in advance. This simplifies storage ownership and code flow. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/log-tree.c b/log-tree.c
index 44febb7..4618dd0 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -349,11 +349,9 @@ void fmt_output_email_subject(struct strbuf *sb, struct rev_info *opt)
}
void log_write_email_headers(struct rev_info *opt, struct commit *commit,
- const char **subject_p,
const char **extra_headers_p,
int *need_8bit_cte_p)
{
- static struct strbuf subject = STRBUF_INIT;
const char *extra_headers = opt->extra_headers;
const char *name = oid_to_hex(opt->zero_commit ?
&null_oid : &commit->object.oid);
@@ -415,9 +413,6 @@ void log_write_email_headers(struct rev_info *opt, struct commit *commit,
opt->diffopt.stat_sep = buffer;
strbuf_release(&filename);
}
- strbuf_reset(&subject);
- fmt_output_email_subject(&subject, opt);
- *subject_p = subject.buf;
*extra_headers_p = extra_headers;
}
@@ -602,8 +597,10 @@ void show_log(struct rev_info *opt)
*/
if (cmit_fmt_is_mail(opt->commit_format)) {
- log_write_email_headers(opt, commit, &ctx.subject, &extra_headers,
+ log_write_email_headers(opt, commit, &extra_headers,
&ctx.need_8bit_cte);
+ ctx.rev = opt;
+ ctx.print_email_subject = 1;
} else if (opt->commit_format != CMIT_FMT_USERFORMAT) {
fputs(diff_get_color_opt(&opt->diffopt, DIFF_COMMIT), opt->diffopt.file);
if (opt->commit_format != CMIT_FMT_ONELINE)