summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-10-18 01:51:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-10-18 05:42:40 (GMT)
commitddf333f66cb8b8647a40e5d39731eaf63ee9fd44 (patch)
treecae4a18b3024dc5c4330e6b8b923d3915fa161e3 /log-tree.c
parent76141e2e6280101362c3c5ddb22699b6f0458100 (diff)
downloadgit-ddf333f66cb8b8647a40e5d39731eaf63ee9fd44.zip
git-ddf333f66cb8b8647a40e5d39731eaf63ee9fd44.tar.gz
git-ddf333f66cb8b8647a40e5d39731eaf63ee9fd44.tar.bz2
pretty: prepare notes message at a centralized place
Instead of passing a boolean show_notes around, pass an optional string that is to be inserted after the log message proper is shown. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/log-tree.c b/log-tree.c
index c894930..84e9f5b 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -540,7 +540,6 @@ void show_log(struct rev_info *opt)
struct pretty_print_context ctx = {0};
opt->loginfo = NULL;
- ctx.show_notes = opt->show_notes;
if (!opt->verbose_header) {
graph_show_commit(opt->graph);
@@ -648,6 +647,18 @@ void show_log(struct rev_info *opt)
if (!commit->buffer)
return;
+ if (opt->show_notes) {
+ int raw;
+ struct strbuf notebuf = STRBUF_INIT;
+
+ raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
+ format_display_notes(commit->object.sha1, &notebuf,
+ get_log_output_encoding(), raw);
+ ctx.notes_message = notebuf.len
+ ? strbuf_detach(&notebuf, NULL)
+ : xcalloc(1, 1);
+ }
+
/*
* And then the pretty-printed message itself
*/
@@ -689,6 +700,7 @@ void show_log(struct rev_info *opt)
}
strbuf_release(&msgbuf);
+ free(ctx.notes_message);
}
int log_tree_diff_flush(struct rev_info *opt)