pretty_print_commit(): do not append notes message
The only case pretty_print_commit() appends notes message to the log message taken from the commit is when show_log() calls it with the notes_message field set, and the output format is not the userformat (i.e. when substituting "%N"). No other users of this function sets this field in the pretty_print_context, as can be easily verified in the previous step. Hoist the code to append the notes message to the caller. Up to this point, no functionality change is intended. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 17, 2012 at 19:02 UTC
5a664cf2c76ed83166f5f3ce7385e3cb058e8834
2 files changed
+3
-3
log-tree.c
+3
@@ -672,6 +672,9 @@ void show_log(struct rev_info *opt)
672
ctx.reflog_info = opt->reflog_info;
673
ctx.fmt = opt->commit_format;
674
pretty_print_commit(&ctx, commit, &msgbuf);
675
+ if ((ctx.fmt != CMIT_FMT_USERFORMAT) &&
676
+ ctx.notes_message && *ctx.notes_message)
677
+ strbuf_addstr(&msgbuf, ctx.notes_message);
678
679
if (opt->add_signoff)
680
append_signoff(&msgbuf, opt->add_signoff);
pretty.c
-3
@@ -1417,9 +1417,6 @@ void pretty_print_commit(const struct pretty_print_context *pp,
1417
if (pp->fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)
1418
strbuf_addch(sb, '\n');
1419
1420
- if (pp->notes_message && *pp->notes_message)
1421
- strbuf_addstr(sb, pp->notes_message);
1422
-
1420
free(reencoded);
1421
}
1422