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

Re: [PATCH] Documentation/diff-options: explain different diff algorithms

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 24, 2018, 20:06 UTC
Message-ID
<xmqq4lgoxusr.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAGZ79kap9TovN2ia4pEgz33dh=9y89cVYZWnB_1e6iHpR=kDOQ@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 31 quoted lines
> On Mon, Jul 23, 2018 at 9:41 PM Jonathan Nieder <jrnieder@gmail.com> wrote:
>>
>> Hi,
>>
>> Stefan Beller wrote:
>>
>> > As a user I wondered what the diff algorithms are about. Offer at least
>> > a basic explanation on the differences of the diff algorithms.
>>
>> Interesting.  Let's see.
>>
>> [...]
>> > --- a/Documentation/diff-options.txt
>> > +++ b/Documentation/diff-options.txt
>> > @@ -94,16 +94,34 @@ diff" algorithm internally.
>> >       Choose a diff algorithm. The variants are as follows:
>> >  +
>> >  --
>> > -`default`, `myers`;;
>> > -     The basic greedy diff algorithm. Currently, this is the default.
>> >  `minimal`;;
>> > +     A diff as produced by the basic greedy algorithm described in
>>
>> Why this reordering?
>
> because Myers (below) is constructed from minimal + heuristic.
> ...
> So the "minimal" algorithm is the basic myers algorithm,
> and the "myers" algorithm is the extended version (extended
> with a heuristic to be fast in corner cases, still producing good
> enough diffs).

I am not sure that is a good reason for the target readers of this document to move the default from the beginning to somewhere in the middle. For a textbook that explains different algorithms and gives overview of how they work, that order may be appropriate, though.

Show 8 quoted lines
>> > -     Spend extra time to make sure the smallest possible diff is
>> > -     produced.
>> > +`default`, `myers`;;
>> > +     The same algorithm as `minimal`, extended with a heuristic to
>> > +     reduce extensive searches. Currently, this is the default.
>>
>> Amusing --- this means that the Myers diff is spelled as "minimal"
>> instead of "myers".

Yeah, I had the same thought---for an end-user documentation update, this change and the reordering does not feel like an improvement.

>> I wonder if these details (about all the algorithms) should go in a
>> separate Diff Algorithms section and this section could focus on
>> what use cases warrant using each, referring to that section for
>> details.  What do you think?
Good suggestion.
Previous: Stefan BellerNext: Stefan Beller
Message 4 of 13 in “Documentation/diff-options: explain different diff algorithms”
  1. Documentation/diff-options: explain different diff algorithmsStefan Beller, Jul 24, 2018
  2. Jonathan NiederJul 24, 2018
  3. Stefan BellerJul 24, 2018
  4. Junio C HamanoJul 24, 2018
  5. Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 6, 2018
  6. Jonathan NiederAug 6, 2018
  7. Junio C HamanoAug 7, 2018
  8. Stefan BellerAug 9, 2018
  9. Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 10, 2018
  10. Stefan BellerAug 9, 2018
  11. 0/2 Getting data on different diff algorithms WAS: Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 10, 2018
  12. 1/2 WIP: range-diff: take extra arguments for different diffs.Stefan Beller, Aug 10, 2018
  13. 2/2 WIP range-diff: print some statistics about the rangeStefan Beller, Aug 10, 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.