Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 510950

Summary: Failed merges do not put the repository in a merge state on Node
Product: [ECD] Orion Reporter: Remy Suen <remy.suen>
Component: GitAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 13.0   
Target Milestone: 14.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 511295    
Bug Blocks:    
Attachments:
Description Flags
Image describing the error in question. none

Description Remy Suen CLA 2017-01-24 08:37:24 EST
Created attachment 266434 [details]
Image describing the error in question.

1. Setup a repository so you have an incoming conflicting change (on the same line and not something that can be auto-resolved).
2. Open the 'Git' page.
3. Click the 'Merge the content from the branch to your active branch' tool item that's in the 'Incoming' section.
4. You'll get a status message about a conflicting change.
5. Notice that it will still say 'Active Branch' instead of 'Merge in progress' in your list of commits.
6. If you try to resolve the conflict and commit, you'll create a new commit on top of your existing branch but the incoming commit will still be there. The new commit will only have one parent instead of two!

This bug prevents anyone from using the Node server to resolve merge conflicts. I cannot think of a workaround at the moment and I don't see such a code path from looking at the code.
Comment 1 Remy Suen CLA 2017-01-24 08:56:01 EST
The diff for the conflicted file is also very weird when compared to the Java server.
Comment 2 Remy Suen CLA 2017-01-25 09:50:28 EST
I have the NodeGit code figured out for creating a proper merge conflict that will be flagged as such (with .git/MERGE_HEAD and all). This will allow Orion to display 'Merge in progress' to the user.

The commit code will also need to be modified so that it will be parented off of HEAD and MERGE_HEAD instead of simply HEAD. Should that be successful, the special files in .git/ will have to be cleaned up accordingly. This is working correctly but my reflog isn't recording the merge commit the same way as if I did it from the command line. This might be a discrepancy between libgit2 and the command line though. I'll look into this some more...
Comment 3 Remy Suen CLA 2017-01-26 05:35:01 EST
(In reply to Remy Suen from comment #2)
> This is working correctly but my reflog isn't recording the
> merge commit the same way as if I did it from the command line. This might
> be a discrepancy between libgit2 and the command line though. I'll look into
> this some more...

libgit2's implementation is different from the CLI so I opened a bug against libgit2 for this.

https://github.com/libgit2/libgit2/issues/4094