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

Re: [PATCH] xdiff: trim common tail with -U0 after diff

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 23, 2017, 19:44 UTC
Message-ID
<xmqqefuaebfr.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kZb+ziJGx6GvSVwX85Szce0zT=2gaF1GpPtz8ft1uhdPw@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> So I tried finding out more about this hack,
> and found the patch that introduced the common tail trimming at
>   https://public-inbox.org/git/7vmysez0oa.fsf@gitster.siamese.dyndns.org/
>   913b45f51b (xdi_diff: trim common trailing lines, 2007-12-13)

A relevant one that makes me hesitate to take this kind of change is this:

https://public-inbox.org/git/alpine.LFD.0.9999.0712202009290.21557@woody.linux-foundation.org/#t
that resulted in this change:
commit d2f82950a9226ae1102a7a97f03440a4bf8c6c09
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Dec 20 20:22:46 2007 -0800
    Re(-re)*fix trim_common_tail()
    
    The tar-ball and the git archive itself is fine, but yes, the diff from
    2.6.23 to 2.6.24-rc6 is bad. It's the "trim_common_tail()" optimization
    that has caused way too much pain.
    
    Very interesting breakage. The patch was actually "correct" in a (rather
    limited) technical sense, but the context at the end was missing because
    while the trim_common_tail() code made sure to keep enough common context
    to allow a valid diff to be generated, the diff machinery itself could
    decide that it could generate the diff differently than the "obvious"
    solution.
    
    Thee sad fact is that the git optimization (which is very important for
    "git blame", which needs no context), is only really valid for that one
    case where we really don't need any context.
Previous: Stefan BellerNext: René Scharfe
Message 4 of 6 in “xdiff: trim common tail with -U0 after diff”
  1. xdiff: trim common tail with -U0 after diffDaniel Hahler, Jun 23, 2017
  2. Junio C HamanoJun 23, 2017
  3. Stefan BellerJun 23, 2017
  4. Junio C HamanoJun 23, 2017
  5. René ScharfeJun 23, 2017
  6. Daniel HahlerJun 23, 2017

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.