git-cinnabar icon indicating copy to clipboard operation
git-cinnabar copied to clipboard

Handle fuzzy copy/renames

Open glandium opened this issue 10 years ago • 5 comments

Like issue #7, but for copy/renames followed by edits.

glandium avatar Feb 02 '15 00:02 glandium

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.

ayg avatar Oct 31 '16 19:10 ayg

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.

ayg avatar Oct 31 '16 19:10 ayg

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.

aethanyc avatar Nov 25 '16 06:11 aethanyc

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 avatar Jul 20 '17 14:07 jrmuizel

@jrmuizel you're essentially asking for issue #97. I'm thinking about it.

glandium avatar Jul 20 '17 20:07 glandium