summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/log.c2
-rw-r--r--interdiff.c13
-rw-r--r--interdiff.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 99ddfe8bb0..8078a43d14 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1086,7 +1086,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
if (rev->idiff_oid1) {
fprintf_ln(rev->diffopt.file, "%s", rev->idiff_title);
- show_interdiff(rev);
+ show_interdiff(rev, 0);
}
}
diff --git a/interdiff.c b/interdiff.c
index d0fac10c7c..c81d680a6c 100644
--- a/interdiff.c
+++ b/interdiff.c
@@ -3,15 +3,26 @@
#include "revision.h"
#include "interdiff.h"
-void show_interdiff(struct rev_info *rev)
+static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
+{
+ return data;
+}
+
+void show_interdiff(struct rev_info *rev, int indent)
{
struct diff_options opts;
+ struct strbuf prefix = STRBUF_INIT;
memcpy(&opts, &rev->diffopt, sizeof(opts));
opts.output_format = DIFF_FORMAT_PATCH;
+ opts.output_prefix = idiff_prefix_cb;
+ strbuf_addchars(&prefix, ' ', indent);
+ opts.output_prefix_data = &prefix;
diff_setup_done(&opts);
diff_tree_oid(rev->idiff_oid1, rev->idiff_oid2, "", &opts);
diffcore_std(&opts);
diff_flush(&opts);
+
+ strbuf_release(&prefix);
}
diff --git a/interdiff.h b/interdiff.h
index 793c0144fe..01c730a5c9 100644
--- a/interdiff.h
+++ b/interdiff.h
@@ -3,6 +3,6 @@
struct rev_info;
-void show_interdiff(struct rev_info *);
+void show_interdiff(struct rev_info *, int indent);
#endif