GNOME Bugzilla – Bug 617098
New versions of Git shows unmerged files as "both modified"
Last modified: 2010-05-24 21:45:37 UTC
Created attachment 159807 [details] [review] patch for /usr/lib/meld/vc/git.py Newer versions of Git (checked with 1.7.0.4) shows merge-diff like this: $ git status # On branch connection-errors # Changes to be committed: # # modified: Session.java # new file: VkException.java # # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: PersonForm.java # both modified: Request.java # Currently melds recognizes such files as "Non VC".
*** Bug 617097 has been marked as a duplicate of this bug. ***
Thanks for the patch. Unfortunately, this patch doesn't apply to Meld HEAD, as we've switched over to using "git diff-index --name-status" to get the same information. Could you please retest with current Meld HEAD, and see if there is a similar bug?
Created attachment 159885 [details] Makes a test repo with different file states (unmerged, added, deleted, modified, untracked) Strange... Seems that command git diff-index --name-status HEAD ./ reports unmerged files as modified ones... /tmp $ ./mkrepo.sh Initialized empty Git repository in /tmp/test-repo/.git/ [master (root-commit) b1f202e] Initial commit 4 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 another1 create mode 100644 another2 create mode 100644 file create mode 100644 justafile Switched to a new branch 'new' [new 28be16b] Modification one 1 files changed, 1 insertions(+), 1 deletions(-) Switched to branch 'master' [master 56bdae4] Modification two 1 files changed, 1 insertions(+), 1 deletions(-) Auto-merging file CONFLICT (content): Merge conflict in file Automatic merge failed; fix conflicts and then commit the result. file: needs merge rm 'another1' Ready... /tmp $ cd test-repo/ /tmp/test-repo $ git status # On branch master # Changes to be committed: # # deleted: another1 # new file: thenewfile1 # # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: file # # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # deleted: another2 # modified: justafile # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # thenewfile2 /tmp/test-repo $ git diff-index --name-status HEAD ./ D another1 D another2 M file M justafile A thenewfile1 /tmp/test-repo $ meld . And here is screenshot: http://s59.radikal.ru/i163/1004/a7/17fe93244cfe.png
So is there something wrong with Meld's behaviour here, or is it okay now that we're using git-diff-index? Also, git-diff-index has a specific code ('U') for unmerged... I don't know why that's not being used here.
Current behaviour is still incorrect, because unmerged files must be shown as unmerged and not as added. But it seems that problem has moved from meld itself to git or our usage of it.
Created attachment 160546 [details] [review] Tentative patch I've spent a little while trying to figure this one out. I'm not convinced that I understand *why* git-diff-index doesn't do what we want, but "git diff-files -0" seems to. Patch attached for testing.
I tested it on my test repo, and here is screenshot: http://funkyimg.com/u2/821/621/2010-05-08-220533_1024x600_scrot.png Meld with this patch doesn't see changes that are already in index. Is it a correct behaviour? Previous version (without patch) showed them: http://s59.radikal.ru/i163/1004/a7/17fe93244cfe.png
In Meld HEAD, this now behaves as it used to, including showing changes in the index. Thanks for the bug report, and for your help tracking down various problems.