path: root/range-diff.h
diff options
authorJohannes Schindelin <>2018-08-13 11:33:07 (GMT)
committerJunio C Hamano <>2018-08-13 17:44:50 (GMT)
commitc8c5e43ac3f9a5b785faf16f10bb8e2c493606a4 (patch)
tree1e7bb98b5729f1649e096e57957c1bc54d70a715 /range-diff.h
parent9dc46e0268028059aecd140254bfe30277d04767 (diff)
range-diff: also show the diff between patches
Just like tbdiff, we now show the diff between matching patches. This is a "diff of two diffs", so it can be a bit daunting to read for the beginner. An alternative would be to display an interdiff, i.e. the hypothetical diff which is the result of first reverting the old diff and then applying the new diff. Especially when rebasing frequently, an interdiff is often not feasible, though: if the old diff cannot be applied in reverse (due to a moving upstream), an interdiff can simply not be inferred. This commit brings `range-diff` closer to feature parity with regard to tbdiff. To make `git range-diff` respect e.g. color.diff.* settings, we have to adjust git_branch_config() accordingly. Note: while we now parse diff options such as --color, the effect is not yet the same as in tbdiff, where also the commit pairs would be colored. This is left for a later commit. Note also: while tbdiff accepts the `--no-patches` option to suppress these diffs between patches, we prefer the `-s` (or `--no-patch`) option that is automatically supported via our use of diff_opt_parse(). And finally note: to support diff options, we have to call `parse_options()` such that it keeps unknown options, and then loop over those and let `diff_opt_parse()` handle them. After that loop, we have to call `parse_options()` again, to make sure that no unknown options are left. Helped-by: Thomas Gummerer <> Helped-by: Eric Sunshine <> Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'range-diff.h')
1 files changed, 3 insertions, 1 deletions
diff --git a/range-diff.h b/range-diff.h
index 7b6eef3..2407d46 100644
--- a/range-diff.h
+++ b/range-diff.h
@@ -1,7 +1,9 @@
#ifndef RANGE_DIFF_H
#define RANGE_DIFF_H
+#include "diff.h"
int show_range_diff(const char *range1, const char *range2,
- int creation_factor);
+ int creation_factor, struct diff_options *diffopt);