Re: [PATCH 0/8] Better heuristics make prettier diffs

2 messages, 2 authors, 2016-08-04 · open the first message on its own page

Re: [PATCH 0/8] Better heuristics make prettier diffs

From: Junio C Hamano <hidden>
Date: 2016-08-04 19:54:59

Jeff King [off-list ref] 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?
The indent heuristic here gets it right.
Looks that way.

Re: [PATCH 0/8] Better heuristics make prettier diffs

From: Jeff King <hidden>
Date: 2016-08-04 20:02:08

On Thu, Aug 04, 2016 at 12:54:51PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help