diff options
author | Jeff King <peff@peff.net> | 2024-03-19 20:30:44 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-19 17:54:15 -0700 |
commit | d5a90d6319aeb6cb3f0b795156c4c2259373424f (patch) | |
tree | acc62eed6a4143f217d5bcc03fa6d463045fbeec /log-tree.c | |
parent | 69aff6200c51cc8a91111b80fbfb84792ce0908c (diff) | |
download | git-d5a90d6319aeb6cb3f0b795156c4c2259373424f.tar.gz |
pretty: drop print_email_subject flag
With one exception, the print_email_subject flag is set if and only if
the commit format is email based:
- in make_cover_letter() we set it along with CMIT_FMT_EMAIL
explicitly
- in show_log(), we set it if cmit_fmt_is_mail() is true. That covers
format-patch as well as "git log --format=email" (or mboxrd).
The one exception is "rev-list --format=email", which somewhat
nonsensically prints the author and date as email headers, but no
subject, like:
$ git rev-list --format=email HEAD
commit 64fc4c2cdd4db2645eaabb47aa4bac820b03cdba
From: Jeff King <peff@peff.net>
Date: Tue, 19 Mar 2024 19:39:26 -0400
this is the subject
this is the body
It's doubtful that this is a useful format at all (the "commit" lines
replace the "From" lines that would make it work as an actual mbox).
But I think that printing the subject as a header (like this patch does)
is the least surprising thing to do.
So let's drop this field, making the code a little simpler and easier to
reason about. Note that we do need to set the "rev" field of the
pretty_print_context in rev-list, since that is used to check for
subject_prefix, etc. It's not possible to set those fields via rev-list,
so we'll always just print "Subject: ". But unless we pass in our
rev_info, fmt_output_email_subject() would segfault trying to figure it
out.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r-- | log-tree.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/log-tree.c b/log-tree.c index 337b9334cd..a765b320dc 100644 --- a/log-tree.c +++ b/log-tree.c @@ -742,7 +742,6 @@ void show_log(struct rev_info *opt) log_write_email_headers(opt, commit, &extra_headers, &ctx.need_8bit_cte, 1); 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) |