Re: [PATCH] range-diff: add a --no-patch option to show a summary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Me again,

On Wed, 7 Nov 2018, Johannes Schindelin wrote:

> On Wed, 7 Nov 2018, Johannes Schindelin wrote:
> 
> > On Wed, 7 Nov 2018, Johannes Schindelin wrote:
> > 
> > > On Tue, 6 Nov 2018, Ævar Arnfjörð Bjarmason wrote:
> > > 
> > > > On Tue, Nov 06 2018, Johannes Schindelin wrote:
> > > > 
> > > > > On Mon, 5 Nov 2018, Ævar Arnfjörð Bjarmason wrote:
> > > > >
> > > > >> On Mon, Nov 05 2018, Eric Sunshine wrote:
> > > > >>
> > > > >> > On Mon, Nov 5, 2018 at 3:07 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
> > > > >> >> Add a --no-patch option which shows which changes got removed, added
> > > > >> >> or moved etc., without showing the diff associated with them.
> > > > >> >
> > > > >> > This option existed in the very first version[1] of range-diff (then
> > > > >> > called branch-diff) implemented by Dscho, although it was called
> > > > >> > --no-patches (with an "es"), which it inherited from tbdiff. I think
> > > > >> > someone (possibly me) pointed out that --no-patch (sans "es") would be
> > > > >> > more consistent with existing Git options. I don't recall why Dscho
> > > > >> > removed the option during the re-rolls, but the explanation may be in
> > > > >> > that thread.
> > > > >>
> > > > >> Thanks for digging. Big thread, not going to re-read it now. I'd just
> > > > >> like to have this.
> > > > >
> > > > > In my hands, the well-documented `-s` option works (see e.g.
> > > > > https://git-scm.com/docs/git-diff#git-diff--s), although I have to admit
> > > > > that the `git-range-diff` manual does not talk about the diff-options.
> > > > >
> > > > > And for the record, for me, `git range-diff A...B --no-patch` *already*
> > > > > works.
> > > > 
> > > > Neither of those works for me without my patch. E.g.
> > > > 
> > > >     ./git-range-diff -s 711aaa392f...a5ba8f2101
> > > >     ./git-range-diff --no-patch 711aaa392f...a5ba8f2101
> > > >
> > > > This is on current next, 2.19.1.1182.g4ecb1133ce. What version are you
> > > > on?
> > > 
> > > I tried it with git version 2.19.0.windows.1.
> > > 
> > > To verify, I repeated this with `next` (git version
> > > 2.19.1.1215.g8438c0b2453a):
> > > 
> > > ./git range-diff -s 711aaa392f...a5ba8f2101
> > > fatal: unrecognized argument: --output-indicator-new=>
> > > error: could not parse log for 'a5ba8f2101..711aaa392f'
> > > 
> > > Which means that something broke rather dramatically between
> > > v2.19.0.windows.1 and 8438c0b2453a.
> > 
> > Nevermind, this was solved by passing `--exec-path=$PWD`. And *now* I can
> > reproduce your finding.
> 
> I've bisected this breakage down to 73a834e9e279 (range-diff: relieve
> callers of low-level configuration burden, 2018-07-22). Eric, that's one
> of your commits.

Okay, so I would really like to point you to this particular paragraph in
the manual page of `git range-diff` (just below
https://git-scm.com/docs/git-range-diff#git-range-diff-ltbasegtltrev1gtltrev2gt):

	`git range-diff` also accepts the regular diff options (see
	linkgit:git-diff[1]), most notably the `--color=[<when>]` and
	`--no-color` options. These options are used when generating the "diff
	between patches", i.e. to compare the author, commit message and diff of
	corresponding old/new commits. There is currently no means to tweak the
	diff options passed to `git log` when generating those patches.

So this was quite intentional, in particular with an eye on `--no-patch`.
Note also the commit message of c8c5e43ac3f9 (range-diff: also show the
diff between patches, 2018-08-13):

    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().

This was very, very intentional, as you can see, and it was pretty broken
by 73a834e. This here patch papers over that breakage, sadly I have too
much on my plate as it is, so I cannot wrap it up in a nice commit (nor
add a regression test, but you did that, nor investigate what else is
broken) and therefore I would be indebted if you could take this in your
custody:

diff --git a/range-diff.c b/range-diff.c
index 3dd2edda0176..014112ee401f 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -433,7 +433,8 @@ int show_range_diff(const char *range1, const char *range2,
 		struct strbuf indent = STRBUF_INIT;
 
 		memcpy(&opts, diffopt, sizeof(opts));
-		opts.output_format = DIFF_FORMAT_PATCH;
+		if (!opts.output_format)
+			opts.output_format = DIFF_FORMAT_PATCH;
 		opts.flags.suppress_diff_headers = 1;
 		opts.flags.dual_color_diffed_diffs = dual_color;
 		opts.output_prefix = output_prefix_cb;

Ciao,
Dscho

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux