From: Jeff King Date: Thu, 04 Aug 2016 20:01:58 GMT Subject: Re: [PATCH 0/8] Better heuristics make prettier diffs Message-ID: <20160804200157.6xq67ceulwyvl7mv@sigill.intra.peff.net> In-Reply-To: On Thu, Aug 04, 2016 at 12:54:51PM -0700, Junio C Hamano wrote: > Jeff King writes: > > > Not that you probably need more random cases of C code, but I happened > > to be looking at a diff in git.git today, b333d0d6, which is another > > regression for the compaction heuristic. > > Wow, that one is _really_ bad. Does it have something to do with > the removal being at the very end of the file? I think so. If it were: func1() { ... unique stuff ... ... shared ending ... } func2() { ... more unique stuff ... ... shared ending ... } unrelated_func() { } and we dropped func2, then I think the blank line between func2() and unrelated_func() would cause the compaction heuristic to stop shifting. OTOH, if it were: func2() { ... } unrelated_func() { } with no newline, you get a similar badly-shifted diff (which is not surprising, as we were given no syntactic hint that "func2" is a separate unit from "unrelated_func"). -Peff