diff options
author | René Scharfe <l.s.r@web.de> | 2017-03-01 14:37:07 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-02 02:09:17 +0300 |
commit | 6d167fd7ccb84f07a0bd57d8e188a651e913b158 (patch) | |
tree | 73b2ac5bf9dd492b1b8112ababde2c2e16caac84 /builtin | |
parent | 8ffc8dc6bab4cf3d2364dd54b2de6c3afdb48610 (diff) |
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 'builtin')
-rw-r--r-- | builtin/log.c | 5 | ||||
-rw-r--r-- | builtin/shortlog.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/builtin/log.c b/builtin/log.c index 55d20cc2d8..281af8c1ec 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -989,8 +989,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, open_next_file(NULL, rev->numbered_files ? NULL : "cover-letter", rev, quiet)) return; - log_write_email_headers(rev, head, &pp.subject, &pp.after_subject, - &need_8bit_cte); + log_write_email_headers(rev, head, &pp.after_subject, &need_8bit_cte); for (i = 0; !need_8bit_cte && i < nr; i++) { const char *buf = get_commit_buffer(list[i], NULL); @@ -1005,6 +1004,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, msg = body; pp.fmt = CMIT_FMT_EMAIL; pp.date_mode.type = DATE_RFC2822; + pp.rev = rev; + pp.print_email_subject = 1; pp_user_info(&pp, NULL, &sb, committer, encoding); pp_title_line(&pp, &msg, &sb, encoding, need_8bit_cte); pp_remainder(&pp, &msg, &sb, 0); diff --git a/builtin/shortlog.c b/builtin/shortlog.c index ba0e1154a9..21402ae8b7 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -143,7 +143,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit) ctx.fmt = CMIT_FMT_USERFORMAT; ctx.abbrev = log->abbrev; - ctx.subject = ""; + ctx.print_email_subject = 1; ctx.after_subject = ""; ctx.date_mode.type = DATE_NORMAL; ctx.output_encoding = get_log_output_encoding(); |