From 126facf8219177bc265be725a8579c86ebdf99a5 Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Sun, 22 Jul 2018 05:57:05 -0400 Subject: format-patch: add --interdiff option to embed diff in cover letter When submitting a revised version of a patch series, it can be helpful (to reviewers) to include a summary of changes since the previous attempt in the form of an interdiff, however, doing so involves manually copy/pasting the diff into the cover letter. Add an --interdiff option to automate this process. The argument to --interdiff specifies the tip of the previous attempt against which to generate the interdiff. For example: git format-patch --cover-letter --interdiff=v1 -3 v2 The previous attempt and the patch series being formatted must share a common base. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- interdiff.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 interdiff.c (limited to 'interdiff.c') diff --git a/interdiff.c b/interdiff.c new file mode 100644 index 0000000000..d0fac10c7c --- /dev/null +++ b/interdiff.c @@ -0,0 +1,17 @@ +#include "cache.h" +#include "commit.h" +#include "revision.h" +#include "interdiff.h" + +void show_interdiff(struct rev_info *rev) +{ + struct diff_options opts; + + memcpy(&opts, &rev->diffopt, sizeof(opts)); + opts.output_format = DIFF_FORMAT_PATCH; + diff_setup_done(&opts); + + diff_tree_oid(rev->idiff_oid1, rev->idiff_oid2, "", &opts); + diffcore_std(&opts); + diff_flush(&opts); +} -- cgit v1.2.3