diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-08-14 14:23:53 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-08-14 14:23:53 -0700 |
| commit | 5cf00cbc0f0134d658c0507160854e677af6d199 (patch) | |
| tree | fd8a504418b0f0a21d59855b976428b1efe18fd9 /interdiff.c | |
| parent | fe8f41fb2a61b36d51099f895e9902fcccc2a2df (diff) | |
| parent | ee6cbf712edcbd1dc14993ab2452fbe882dc524a (diff) | |
| download | git-5cf00cbc0f0134d658c0507160854e677af6d199.tar.xz | |
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 'interdiff.c')
| -rw-r--r-- | interdiff.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/interdiff.c b/interdiff.c new file mode 100644 index 0000000000..c81d680a6c --- /dev/null +++ b/interdiff.c @@ -0,0 +1,28 @@ +#include "cache.h" +#include "commit.h" +#include "revision.h" +#include "interdiff.h" + +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); +} |
