Re: [PATCH] Fix -B "very-different" logic.
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Jun 3, 2005, 00:21 UTC
- Message-ID
- <Pine.LNX.4.58.0506021716140.1876@ppc970.osdl.org>
- In-Reply-To
- <7vll5sz54z.fsf_-_@assigned-by-dhcp.cox.net>
On Thu, 2 Jun 2005, Junio C Hamano wrote:
Show 6 quoted lines
> > However I think the diffcore-break algorithm itself was basing > its "very_different" computation on numbers somewhat bogus. It > was counting newly inserted bytes into account, but amount of > those bytes should not make any difference when determining if > the change is a complete rewrite.
Careful.
I think the amount of new code _should_ matter. Otherwise, an old empty file would always be considered the source of a new file, since the diff doesn't remove anything. Similarly, just because we have a boilerplate file shouldn't make that always be considered a "wonderful source", when people add the real meat to it.
So I think you're on the right track, but I don't think you should entirely dismiss "lots of stuff added" as a reason for a "break". I think that if the new stuff is _much_ larger than the old stuff, it might as well be considered a rewrite.
In particular, let's say that I used to have two files:
a.c - small helper functions b.c - the "meat" of the thing
and I end up deciding that I might as well collapse it all into one file, a.c. What happens? There's almost no deletes from a.c, but there's a lot of new code in it.
Wouldn't it be _better_ if you considered the new "a.c" a new file, so that you might notice that it's actually _closer_ to the old removed "b.c" than the old "a.c"?
See what I'm saying?
Linus