Merge branch 'nd/commit-doc'
[git] / interdiff.c
1 #include "cache.h"
2 #include "commit.h"
3 #include "revision.h"
4 #include "interdiff.h"
5
6 static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
7 {
8         return data;
9 }
10
11 void show_interdiff(struct rev_info *rev, int indent)
12 {
13         struct diff_options opts;
14         struct strbuf prefix = STRBUF_INIT;
15
16         memcpy(&opts, &rev->diffopt, sizeof(opts));
17         opts.output_format = DIFF_FORMAT_PATCH;
18         opts.output_prefix = idiff_prefix_cb;
19         strbuf_addchars(&prefix, ' ', indent);
20         opts.output_prefix_data = &prefix;
21         diff_setup_done(&opts);
22
23         diff_tree_oid(rev->idiff_oid1, rev->idiff_oid2, "", &opts);
24         diffcore_std(&opts);
25         diff_flush(&opts);
26
27         strbuf_release(&prefix);
28 }