Re: [PATCH v4 05/21] range-diff: also show the diff between patches
From: Eric Sunshine <hidden>
Date: 2018-07-29 19:22:24
On Sun, Jul 29, 2018 at 3:04 PM Thomas Gummerer [off-list ref] wrote:
On 07/21, Johannes Schindelin via GitGitGadget wrote:quoted
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. [...] Note also: while tbdiff accepts the `--no-patches` option to suppress these diffs between patches, we prefer the `-s` option that is automatically supported via our use of diff_opt_parse().One slightly unfortunate thing here is that we don't show these options in 'git range-diff -h', which would be nice to have. I don't know if that's possible in git right now, if it's not easily possible, I definitely wouldn't want to delay this series for that, and we could just add it to the list of possible future enhancements that other people mentioned.
This issue is not specific to git-range-diff; it's shared by other commands which inherit diff options via diff_opt_parse(). For instance, "git log -h" doesn't show diff-related options either, yet it accepts them.
quoted
diff --git a/range-diff.c b/range-diff.c@@ -300,6 +325,9 @@ static void output(struct string_list *a, struct string_list *b) printf("%d: %s ! %d: %s\n", b_util->matching + 1, short_oid(a_util), j + 1, short_oid(b_util)); + if (!(diffopt->output_format & DIFF_FORMAT_NO_OUTPUT))Looking at this line, it looks like it would be easy to support '--no-patches' as well, which may be slightly easier to understand that '-s' to someone new to the command. But again that can be added later if someone actually cares about it.
What wasn't mentioned (but was implied) by the commit message is that "-s" is short for "--no-patch", which also comes for free via diff_opt_parse(). True, "--no-patch" isn't spelled exactly the same as "--no-patches", but git-range-diff isn't exactly a perfect tbdiff clone, so hopefully not a git problem. Moreover, "--no-patch" is internally consistent within the Git builtin commands.