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

Re: [RFD] Combine diff improvements

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2013, 05:54 UTC
Message-ID
<7vboalw6lt.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALWbr2zY3uo==QTd69t1eXNS4-CX1w3T-AaMjOLVmxj-SMJyvg@mail.gmail.com>
Antoine Pelisse <apelisse@gmail.com> writes:
Show 14 quoted lines
> While if we invert the two parents order we will have:
> - 3
> --1
> --2
> - 4
>  -3
>  -4
>
> While clearly, in both cases, the optimal solution would be close to:
> - 3
> --1
> --2
>  -3
> --4

We should shoot for better readability as the primary goal. When I am viewing "--cc" output, I find it easier to read if the lines for the same parent are consecutive. That is, I find the right one far easier to grok than the left one:

     - 1                - 1
      -2                - 3
     - 3                 -2
      -4                 -4

when trying to see what got changed from the first parent (we had 1 and then 3 and whatever comes after this block; 2 and 4 are noise and it makes it easier to skip them because they are together).

This can probably be done as a post-process phase after you find the coalescing matches to express the result in the smallest number of lines, but I thought it is worth mentioning that not all solutions with the same number of lines are equally good.

Previous: Junio C HamanoNext: Antoine Pelisse
Message 3 of 9 in “[RFD] Combine diff improvements”
  1. Antoine PelisseMar 14, 2013
  2. Junio C HamanoMar 14, 2013
  3. Junio C HamanoMar 15, 2013
  4. combine-diff: coalesce lost lines optimallyAntoine Pelisse, Mar 17, 2013
  5. Antoine PelisseMar 17, 2013
  6. Junio C HamanoMar 17, 2013
  7. Antoine PelisseMar 17, 2013
  8. Junio C HamanoMar 17, 2013
  9. combine-diff: coalesce lost lines optimallyAntoine Pelisse, Mar 23, 2013

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.