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.
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