aboutsummaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-10-17 21:27:22 -0700
committerJunio C Hamano <gitster@pobox.com>2012-10-17 22:42:40 -0700
commitbd1470b8cb0cfb42c7de3b9084cdd8ae53aa1d4c (patch)
tree9bcc985a19574ae25c5edf4743341d3f7dfc3856 /log-tree.c
parent212620fe7e74f6bd4a30a5a39d7c7b3f685ef888 (diff)
downloadgit-bd1470b8cb0cfb42c7de3b9084cdd8ae53aa1d4c.tar.gz
git-bd1470b8cb0cfb42c7de3b9084cdd8ae53aa1d4c.tar.xz
format-patch --notes: show notes after three-dashes
When inserting the note after the commit log message to format-patch output, add three dashes before the note. Record the fact that we did so in the rev_info and omit showing duplicated three dashes in the usual codepath that is used when notes are not being shown. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/log-tree.c b/log-tree.c
index 4390b117e..712a22b19 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -677,8 +677,13 @@ void show_log(struct rev_info *opt)
append_signoff(&msgbuf, opt->add_signoff);
if ((ctx.fmt != CMIT_FMT_USERFORMAT) &&
- ctx.notes_message && *ctx.notes_message)
+ ctx.notes_message && *ctx.notes_message) {
+ if (ctx.fmt == CMIT_FMT_EMAIL) {
+ strbuf_addstr(&msgbuf, "---\n");
+ opt->shown_dashes = 1;
+ }
strbuf_addstr(&msgbuf, ctx.notes_message);
+ }
if (opt->show_log_size) {
printf("log size %i\n", (int)msgbuf.len);
@@ -710,6 +715,7 @@ void show_log(struct rev_info *opt)
int log_tree_diff_flush(struct rev_info *opt)
{
+ opt->shown_dashes = 0;
diffcore_std(&opt->diffopt);
if (diff_queue_is_empty()) {
@@ -737,10 +743,11 @@ int log_tree_diff_flush(struct rev_info *opt)
opt->diffopt.output_prefix_data);
fwrite(msg->buf, msg->len, 1, stdout);
}
- if ((pch & opt->diffopt.output_format) == pch) {
- printf("---");
+ if (!opt->shown_dashes) {
+ if ((pch & opt->diffopt.output_format) == pch)
+ printf("---");
+ putchar('\n');
}
- putchar('\n');
}
}
diff_flush(&opt->diffopt);