git-cinnabar
git-cinnabar copied to clipboard
Handle fuzzy copy/renames
Like issue #7, but for copy/renames followed by edits.
Probably the only solution here that will reliably give desired behavior is to allow the user to manually record renames and copies, the way Mercurial does. Require that git users do git mv or git cp (git cp doesn't exist yet, of course) when they want an inexact rename/copy to be recorded, and have that record some sort of metadata that git-cinnabar will use. It should also affect diff display in git itself, to avoid confusion. It doesn't seem likely that a heuristic-based solution will ever work reliably.
In https://hg.mozilla.org/try/rev/53f0c7b996576b591e1489e07a1e710c90b12cd2, I count six lines the same in a file that goes from 42 to 61 lines, using diff -u. Using diff -uw it's most of the file, but it seems git considers whitespace significant when counting unchanged lines. In this case I had to rewrite the file as I renamed it, because the name changed from .xul to .html and I had to rewrite the XUL as HTML at the same time.
I hit this today when uploading a patch to mozreview by git-cinnabar. A plain rename file A to B via git mv A B
is correctly recognized. However, if I made some changes to B, it'll be recognized as A deleted and B added.
I've run into this a couple of times too. Would it be possible to record the hg copy/move metadata someplace and then have some way to add that metadata through cinnabar?
@jrmuizel you're essentially asking for issue #97. I'm thinking about it.