git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [WIP-PATCH 3/3] pretty_print_commit(): do not append notes message
Date: Wed, 17 Oct 2012 19:20:18 -0700	[thread overview]
Message-ID: <1350526818-354-4-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1350526818-354-1-git-send-email-gitster@pobox.com>

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 <gitster@pobox.com>
---
 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);
-
 	free(reencoded);
 }
 
-- 
1.8.0.rc3.112.gdb88a5e

      parent reply	other threads:[~2012-10-18  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  2:20 [WIP-PATCH 0/3] Cleaning up "notes" in log output Junio C Hamano
2012-10-18  2:20 ` [WIP-PATCH 1/3] pretty: remove reencode_commit_message() Junio C Hamano
2012-10-18  2:20 ` [WIP-PATCH 2/3] pretty: prepare notes message at a centralized place Junio C Hamano
2012-10-18  2:20 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350526818-354-4-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).