summaryrefslogtreecommitdiff
path: root/pretty.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 /pretty.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 'pretty.c')
-rw-r--r--pretty.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pretty.c b/pretty.c
index 37b2c3b..faeb3d9 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1590,8 +1590,9 @@ void pp_title_line(struct pretty_print_context *pp,
pp->preserve_subject ? "\n" : " ");
strbuf_grow(sb, title.len + 1024);
- if (pp->subject) {
- strbuf_addstr(sb, pp->subject);
+ if (pp->print_email_subject) {
+ if (pp->rev)
+ fmt_output_email_subject(sb, pp->rev);
if (needs_rfc2047_encoding(title.buf, title.len, RFC2047_SUBJECT))
add_rfc2047(sb, title.buf, title.len,
encoding, RFC2047_SUBJECT);
@@ -1801,7 +1802,7 @@ void pretty_print_commit(struct pretty_print_context *pp,
}
pp_header(pp, encoding, commit, &msg, sb);
- if (pp->fmt != CMIT_FMT_ONELINE && !pp->subject) {
+ if (pp->fmt != CMIT_FMT_ONELINE && !pp->print_email_subject) {
strbuf_addch(sb, '\n');
}