Merge branch 'master' of git://git.kernel.org/pub/scm/git/git
[git.git] / interdiff.c
blobc81d680a6cee08eaa44a840a6fc8e836bc2a3a1b
1 #include "cache.h"
2 #include "commit.h"
3 #include "revision.h"
4 #include "interdiff.h"
6 static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
8 return data;
11 void show_interdiff(struct rev_info *rev, int indent)
13 struct diff_options opts;
14 struct strbuf prefix = STRBUF_INIT;
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);
23 diff_tree_oid(rev->idiff_oid1, rev->idiff_oid2, "", &opts);
24 diffcore_std(&opts);
25 diff_flush(&opts);
27 strbuf_release(&prefix);