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

Re: [RFC PATCH, WAS: "weird diff output?" 0/2] implement better chunk heuristics

From
Stefan Beller <sbeller@google.com>
Date
Apr 15, 2016, 17:33 UTC
Message-ID
<CAGZ79kZPsGuimv3pFAFdwuhD1ps74qx7Q6d1kqxxRX6VPwNYGQ@mail.gmail.com>
In-Reply-To
<xmqq1t66dbp8.fsf@gitster.mtv.corp.google.com>
On Fri, Apr 15, 2016 at 10:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> Actually we would only need to have the empty line count in the
>> second loop as the first loop shifted it as much up(backwards) as
>> possible, such that the hunk sits on one end of the movable
>> range. The second loop would iterate over the whole range, so that
>> would be the only place needed to count.
>
> The description makes me wonder if we can do without two loops ;-)

I think the existing 2 loops are needed to move "as much as possible" to either boundary to see if there is overlap to another group and combine the groups if so. (This whole construction prior to these patches remind me of shaker sort)

>
> That is, can we teach the first loop not to be so aggressive to
> shift "as much as possible" but notice there is an empty line we
> would want to treat specially?

I think we need to be aggressive to find adjacent groups and only after that is done we should think about optimizing look&feel? That is why I even proposed to not touch the current 2 loops at all and have our own loop to find out if there is at least one empty line.

Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 22 in “implement better chunk heuristics”
  1. 0/2 implement better chunk heuristicsJacob Keller, Apr 15, 2016
  2. 1/2 xdiff: add xdl_hash_and_recmatch helper functionJacob Keller, Apr 15, 2016
  3. Junio C HamanoApr 15, 2016
  4. Jacob KellerApr 15, 2016
  5. 2/2 xdiff: implement empty line chunk heuristicJacob Keller, Apr 15, 2016
  6. Stefan BellerApr 15, 2016
  7. Junio C HamanoApr 15, 2016
  8. Jacob KellerApr 15, 2016
  9. Junio C HamanoApr 15, 2016
  10. Jacob KellerApr 15, 2016
  11. Jacob KellerApr 15, 2016
  12. Junio C HamanoApr 15, 2016
  13. Jacob KellerApr 15, 2016
  14. Jacob KellerApr 15, 2016
  15. Stefan BellerApr 15, 2016
  16. Stefan BellerApr 15, 2016
  17. Junio C HamanoApr 15, 2016
  18. Stefan BellerApr 15, 2016
  19. Junio C HamanoApr 15, 2016
  20. Jacob KellerApr 15, 2016
  21. Jacob KellerApr 15, 2016
  22. Jacob KellerApr 15, 2016

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.