aboutsummaryrefslogtreecommitdiffstats
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-14 14:23:53 -0700
committerJunio C Hamano <gitster@pobox.com>2018-08-14 14:23:53 -0700
commit5cf00cbc0f0134d658c0507160854e677af6d199 (patch)
treefd8a504418b0f0a21d59855b976428b1efe18fd9 /log-tree.c
parentfe8f41fb2a61b36d51099f895e9902fcccc2a2df (diff)
parentee6cbf712edcbd1dc14993ab2452fbe882dc524a (diff)
downloadgit-5cf00cbc0f0134d658c0507160854e677af6d199.tar.gz
Merge branch 'es/format-patch-interdiff' into es/format-patch-rangediff
* es/format-patch-interdiff: format-patch: allow --interdiff to apply to a lone-patch log-tree: show_log: make commentary block delimiting reusable interdiff: teach show_interdiff() to indent interdiff format-patch: teach --interdiff to respect -v/--reroll-count format-patch: add --interdiff option to embed diff in cover letter format-patch: allow additional generated content in make_cover_letter()
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/log-tree.c b/log-tree.c
index c0ac7af7cb..e21c3d959f 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -15,6 +15,7 @@
#include "sequencer.h"
#include "line-log.h"
#include "help.h"
+#include "interdiff.h"
static struct decoration name_decoration = { "object names" };
static int decoration_loaded;
@@ -542,6 +543,16 @@ static int show_mergetag(struct rev_info *opt, struct commit *commit)
return for_each_mergetag(show_one_mergetag, commit, opt);
}
+static void next_commentary_block(struct rev_info *opt, struct strbuf *sb)
+{
+ const char *x = opt->shown_dashes ? "\n" : "---\n";
+ if (sb)
+ strbuf_addstr(sb, x);
+ else
+ fputs(x, opt->diffopt.file);
+ opt->shown_dashes = 1;
+}
+
void show_log(struct rev_info *opt)
{
struct strbuf msgbuf = STRBUF_INIT;
@@ -699,10 +710,8 @@ void show_log(struct rev_info *opt)
if ((ctx.fmt != CMIT_FMT_USERFORMAT) &&
ctx.notes_message && *ctx.notes_message) {
- if (cmit_fmt_is_mail(ctx.fmt)) {
- strbuf_addstr(&msgbuf, "---\n");
- opt->shown_dashes = 1;
- }
+ if (cmit_fmt_is_mail(ctx.fmt))
+ next_commentary_block(opt, &msgbuf);
strbuf_addstr(&msgbuf, ctx.notes_message);
}
@@ -729,6 +738,19 @@ void show_log(struct rev_info *opt)
strbuf_release(&msgbuf);
free(ctx.notes_message);
+
+ if (cmit_fmt_is_mail(ctx.fmt) && opt->idiff_oid1) {
+ struct diff_queue_struct dq;
+
+ memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
+ DIFF_QUEUE_CLEAR(&diff_queued_diff);
+
+ next_commentary_block(opt, NULL);
+ fprintf_ln(opt->diffopt.file, "%s", opt->idiff_title);
+ show_interdiff(opt, 2);
+
+ memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
+ }
}
int log_tree_diff_flush(struct rev_info *opt)
@@ -766,9 +788,10 @@ int log_tree_diff_flush(struct rev_info *opt)
/*
* We may have shown three-dashes line early
- * between notes and the log message, in which
- * case we only want a blank line after the
- * notes without (an extra) three-dashes line.
+ * between generated commentary (notes, etc.)
+ * and the log message, in which case we only
+ * want a blank line after the commentary
+ * without (an extra) three-dashes line.
* Otherwise, we show the three-dashes line if
* we are showing the patch with diffstat, but
* in that case, there is no extra blank line