Skip to content

Commit 82363d9

Browse files
peffgitster
authored andcommitted
log: do not set up extra_headers for non-email formats
The commit pretty-printer code has an "after_subject" parameter which it uses to insert extra headers into the email format. In show_log() we set this by calling log_write_email_headers() if we are using an email format, but otherwise default the variable to the rev_info.extra_headers variable. Since the pretty-printer code will ignore after_subject unless we are using an email format, this default is pointless. We can just set after_subject directly, eliminating an extra variable. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d5a90d6 commit 82363d9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

log-tree.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ void show_log(struct rev_info *opt)
678678
struct log_info *log = opt->loginfo;
679679
struct commit *commit = log->commit, *parent = log->parent;
680680
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : the_hash_algo->hexsz;
681-
const char *extra_headers = opt->extra_headers;
682681
struct pretty_print_context ctx = {0};
683682

684683
opt->loginfo = NULL;
@@ -739,7 +738,7 @@ void show_log(struct rev_info *opt)
739738
*/
740739

741740
if (cmit_fmt_is_mail(opt->commit_format)) {
742-
log_write_email_headers(opt, commit, &extra_headers,
741+
log_write_email_headers(opt, commit, &ctx.after_subject,
743742
&ctx.need_8bit_cte, 1);
744743
ctx.rev = opt;
745744
} else if (opt->commit_format != CMIT_FMT_USERFORMAT) {
@@ -807,7 +806,6 @@ void show_log(struct rev_info *opt)
807806
ctx.date_mode = opt->date_mode;
808807
ctx.date_mode_explicit = opt->date_mode_explicit;
809808
ctx.abbrev = opt->diffopt.abbrev;
810-
ctx.after_subject = extra_headers;
811809
ctx.preserve_subject = opt->preserve_subject;
812810
ctx.encode_email_headers = opt->encode_email_headers;
813811
ctx.reflog_info = opt->reflog_info;

0 commit comments

Comments
 (0)