git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	Stefan Beller <sbeller@google.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v3 2/2] range-diff: fix regression in passing along diff options
Date: Fri, 9 Nov 2018 01:46:17 -0500	[thread overview]
Message-ID: <CAPig+cSJ=T_iwPOaxT9T0XK2UYZfvkE_Vx5D__ZLct+z1-p5cg@mail.gmail.com> (raw)
In-Reply-To: <87k1ln5hcx.fsf@evledraar.gmail.com>

On Thu, Nov 8, 2018 at 5:34 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> On Thu, Nov 08 2018, Eric Sunshine wrote:
> > Looking at diff.c:parse_diff_opt() and enable_patch_output(), rather
> > than introducing this new conditional, I'm thinking that a more
> > correct fix would be:
> >
> >     opts.output_format |= DIFF_FORMAT_PATCH;
> >
> > (note the '|=' operator). This would result in 'opts.output_format'
> > containing (DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT), just as it did
> > prior to 73a834e9e2 when --no-patch was specified.
>
> Maybe I'm misunderstanding, but if you mean this on top:
>
>     -               if (!opts.output_format)
>     -                       opts.output_format = DIFF_FORMAT_PATCH;
>     +               opts.output_format |= DIFF_FORMAT_PATCH;

That is indeed what I mean.

> Then the --stat test I've added here fails, because unlike "diff" the
> "--stat" (and others) will implicitly "--patch" and you need
> "--no-patch" as well (again, unlike with "diff").

This new --stat test also fails with Dscho's original git-range-diff
implementation, even before 73a834e9e2 regressed the --no-patch case.
The commit message seems to sell this patch as a pure regression-fix,
so it feels wrong for it to be conflating a regression fix
(--no-patch) with preparation for potential future improvements to
other options (--stat, etc.).

I could see this as a two-patch series in which patch 1/2 fixes the
regression (with, say, "|="), and patch 2/2 generalizes setting
'opts.output_format' for the future. Alternately, if left as a single
patch, perhaps the commit message could be fleshed out to better
explain that it is doing more than merely fixing a regression (since
it wasn't at all obvious to me, even after digging into the code
earlier to come up with "|=", or now when trying to understand your
response).

> Right now --stat is pretty useless, but it could be made to make sense,
> and at that point (and earlier) I think it would be confusing if
> "range-diff" had different semantics with no options v.s. one option
> like "--stat" v.s. "--stat -p" compared to "diff".

Perhaps this sort of rationale, along with some explanatory examples
could be added to the commit message to help the reader more fully
understand the situation.

Thanks for working on this.

  reply	other threads:[~2018-11-09  6:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 20:06 [PATCH] range-diff: add a --no-patch option to show a summary Ævar Arnfjörð Bjarmason
2018-11-05 20:26 ` Eric Sunshine
2018-11-05 21:00   ` Ævar Arnfjörð Bjarmason
2018-11-06 10:43     ` Johannes Schindelin
2018-11-06 16:01       ` Ævar Arnfjörð Bjarmason
2018-11-07 10:34         ` Johannes Schindelin
2018-11-07 10:43           ` Johannes Schindelin
2018-11-07 10:55             ` Johannes Schindelin
2018-11-07 11:08               ` Johannes Schindelin
2018-11-07 12:22                 ` [PATCH v3 0/2] range-diff: doc + regression fix Ævar Arnfjörð Bjarmason
2018-11-07 12:22                 ` [PATCH v3 1/2] range-diff doc: add a section about output stability Ævar Arnfjörð Bjarmason
2018-11-07 13:10                   ` Stephen & Linda Smith
2018-11-07 22:52                     ` Junio C Hamano
2018-11-07 19:06                   ` Martin Ågren
2018-11-07 12:22                 ` [PATCH v3 2/2] range-diff: fix regression in passing along diff options Ævar Arnfjörð Bjarmason
2018-11-08 17:08                   ` Eric Sunshine
2018-11-08 22:34                     ` Ævar Arnfjörð Bjarmason
2018-11-09  6:46                       ` Eric Sunshine [this message]
2018-11-09  7:36                         ` Ævar Arnfjörð Bjarmason
2018-11-09 10:18                   ` [PATCH v4 0/3] range-diff fixes Ævar Arnfjörð Bjarmason
2018-11-09 16:32                     ` Johannes Schindelin
2018-11-09 10:18                   ` [PATCH v4 1/3] range-diff doc: add a section about output stability Ævar Arnfjörð Bjarmason
2018-11-09 10:18                   ` [PATCH v4 2/3] range-diff: fix regression in passing along diff options Ævar Arnfjörð Bjarmason
2018-11-09 10:18                   ` [PATCH v4 3/3] range-diff: make diff option behavior (e.g. --stat) consistent Ævar Arnfjörð Bjarmason
2018-11-09 13:25                     ` Stephen & Linda Smith
2018-11-11  8:43                     ` Eric Sunshine
2018-11-12  3:17                       ` Junio C Hamano
2018-11-12  3:32                     ` Junio C Hamano
2018-11-13 18:55                       ` [PATCH v5 0/3] range-diff fixes Ævar Arnfjörð Bjarmason
2018-11-14 15:36                         ` Johannes Schindelin
2018-11-13 18:55                       ` [PATCH v5 1/3] range-diff doc: add a section about output stability Ævar Arnfjörð Bjarmason
2018-11-13 18:55                       ` [PATCH v5 2/3] range-diff: fix regression in passing along diff options Ævar Arnfjörð Bjarmason
2018-11-13 18:55                       ` [PATCH v5 3/3] range-diff: make diff option behavior (e.g. --stat) consistent Ævar Arnfjörð Bjarmason
2018-11-06  4:16 ` [PATCH] range-diff: add a --no-patch option to show a summary Junio C Hamano
2018-11-06  5:15   ` Eric Sunshine
2018-11-06  5:57     ` Junio C Hamano
2018-11-06  8:36     ` Ævar Arnfjörð Bjarmason
2018-11-06 16:24 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2018-11-07  0:57   ` Junio C Hamano
2018-11-07 11:11     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cSJ=T_iwPOaxT9T0XK2UYZfvkE_Vx5D__ZLct+z1-p5cg@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=lucas.demarchi@intel.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).