From 6d167fd7ccb84f07a0bd57d8e188a651e913b158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 1 Mar 2017 12:37:07 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- log-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'log-tree.c') diff --git a/log-tree.c b/log-tree.c index 44febb75ab..4618dd04ca 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) -- cgit v1.2.3