On Thu, Mar 22, 2012 at 12:12:06PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
That is a slight layering violation, in that we are making assumptions
about how the diffcore-rename subsystem works.
I do not think I have to say any more than that. The special case we want
to have is for the "empty to empty" case and nothing else, and I do not
want to see people having to remember to look at the merge-recursive code
if/when rename detection starts to treat "empty to small" as "rename with
minor modification."
Here's a 2-patch series to replace the old 3/3 (they go on top of the
first two cleanups from the previous iteration).
[1/2]: teach diffcore-rename to optionally ignore empty content
[2/2]: merge-recursive: don't detect renames of empty files
Thinking on this more, it is actually a more generic problem than just
empty files. It is really a problem of having generic placeholder files
with the same content. So a fully general solution would be something
like a gitattribute for "don't do renames on this". However, in
practice, these placeholder files are empty (since any non-empty file is
likely to actually have different content). So I think just dropping the
empty files as rename candidates is a pretty good heuristic, and it's
nice and simple.
After responding to Jonathan, I'm on the fence about whether diff should
follow the same heuristic. I left the diff behavior unchanged, but a 3/2
that turns it off by default would be a trivial one-liner.
-Peff