Skip to content

Commit

Permalink
pretty_print_commit(): do not append notes message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Oct 18, 2012
1 parent ddf333f commit 5a664cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions log-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ 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.notes_message && *ctx.notes_message)
strbuf_addstr(&msgbuf, ctx.notes_message);

if (opt->add_signoff)
append_signoff(&msgbuf, opt->add_signoff);
Expand Down
3 changes: 0 additions & 3 deletions pretty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->notes_message && *pp->notes_message)
strbuf_addstr(sb, pp->notes_message);

free(reencoded);
}

Expand Down

0 comments on commit 5a664cf

Please sign in to comment.