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
after_message_body field set and the output format is not the
userformat.  No other users of this function sets this field in the
pretty_print_context, as can be seen 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 <>
 log-tree.c | 2 ++
 pretty.c   | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 95ff405..6e141f0 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -673,6 +673,8 @@ void show_log(struct rev_info *opt)
        ctx.reflog_info = opt->reflog_info;
        ctx.fmt = opt->commit_format;
        pretty_print_commit(&ctx, commit, &msgbuf);
+       if ((ctx.fmt != CMIT_FMT_USERFORMAT) && ctx.after_message_body)
+               strbuf_addbuf(&msgbuf, ctx.after_message_body);
        if (opt->add_signoff)
                append_signoff(&msgbuf, opt->add_signoff);
diff --git a/pretty.c b/pretty.c
index bdd991c..ad27325 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1417,9 +1417,6 @@ void pretty_print_commit(const struct 
pretty_print_context *pp,
        if (pp->fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)
                strbuf_addch(sb, '\n');
-       if (pp->after_message_body)
-               strbuf_addbuf(sb, pp->after_message_body);

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to