git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/2] range-diff: fix regression in passing along diff options

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 9, 2018, 07:36 UTC
Message-ID
<87in1666t9.fsf@evledraar.gmail.com>
In-Reply-To
<CAPig+cSJ=T_iwPOaxT9T0XK2UYZfvkE_Vx5D__ZLct+z1-p5cg@mail.gmail.com>
On Fri, Nov 09 2018, Eric Sunshine wrote:
Show 19 quoted lines
> 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.
*Nod*
Show 19 quoted lines
>> 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).

Yeah that makes sense. I did not see (but see now) that the --stat behavior was different now v.s. before your 73a834e9e2.

Show 8 quoted lines
>> 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.
*Nod*
Previous: Eric SunshineNext: Ævar Arnfjörð Bjarmason
Message 19 of 40 in “range-diff: add a --no-patch option to show a summary”
  1. range-diff: add a --no-patch option to show a summaryÆvar Arnfjörð Bjarmason, Nov 5, 2018
  2. Eric SunshineNov 5, 2018
  3. Ævar Arnfjörð BjarmasonNov 5, 2018
  4. Johannes SchindelinNov 6, 2018
  5. Ævar Arnfjörð BjarmasonNov 6, 2018
  6. Johannes SchindelinNov 7, 2018
  7. Johannes SchindelinNov 7, 2018
  8. Johannes SchindelinNov 7, 2018
  9. Johannes SchindelinNov 7, 2018
  10. 0/2 range-diff: doc + regression fixÆvar Arnfjörð Bjarmason, Nov 7, 2018
  11. 1/2 range-diff doc: add a section about output stabilityÆvar Arnfjörð Bjarmason, Nov 7, 2018
  12. Stephen & Linda SmithNov 7, 2018
  13. Junio C HamanoNov 7, 2018
  14. Martin ÅgrenNov 7, 2018
  15. 2/2 range-diff: fix regression in passing along diff optionsÆvar Arnfjörð Bjarmason, Nov 7, 2018
  16. Eric SunshineNov 8, 2018
  17. Ævar Arnfjörð BjarmasonNov 8, 2018
  18. Eric SunshineNov 9, 2018
  19. Ævar Arnfjörð BjarmasonNov 9, 2018
  20. 0/3 range-diff fixesÆvar Arnfjörð Bjarmason, Nov 9, 2018
  21. Johannes SchindelinNov 9, 2018
  22. 1/3 range-diff doc: add a section about output stabilityÆvar Arnfjörð Bjarmason, Nov 9, 2018
  23. 2/3 range-diff: fix regression in passing along diff optionsÆvar Arnfjörð Bjarmason, Nov 9, 2018
  24. 3/3 range-diff: make diff option behavior (e.g. --stat) consistentÆvar Arnfjörð Bjarmason, Nov 9, 2018
  25. Stephen & Linda SmithNov 9, 2018
  26. Eric SunshineNov 11, 2018
  27. Junio C HamanoNov 12, 2018
  28. Junio C HamanoNov 12, 2018
  29. 0/3 range-diff fixesÆvar Arnfjörð Bjarmason, Nov 13, 2018
  30. Johannes SchindelinNov 14, 2018
  31. 1/3 range-diff doc: add a section about output stabilityÆvar Arnfjörð Bjarmason, Nov 13, 2018
  32. 2/3 range-diff: fix regression in passing along diff optionsÆvar Arnfjörð Bjarmason, Nov 13, 2018
  33. 3/3 range-diff: make diff option behavior (e.g. --stat) consistentÆvar Arnfjörð Bjarmason, Nov 13, 2018
  34. Junio C HamanoNov 6, 2018
  35. Eric SunshineNov 6, 2018
  36. Junio C HamanoNov 6, 2018
  37. Ævar Arnfjörð BjarmasonNov 6, 2018
  38. range-diff: add a --no-patch option to show a summaryÆvar Arnfjörð Bjarmason, Nov 6, 2018
  39. Junio C HamanoNov 7, 2018
  40. Johannes SchindelinNov 7, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.