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

Bug 328841

Summary: wrong merge ? native git reporting conflicts, while egit says "no conflicts"
Product: [Technology] EGit Reporter: Matthias Sohn <matthias.sohn>
Component: CoreAssignee: Christian Halstrick <christian.halstrick>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: christian.halstrick, christian.halstrick, lcf, shivamshukla
Version: 0.10.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=501513
Whiteboard:
Bug Depends on:    
Bug Blocks: 501513    

Description Matthias Sohn CLA 2010-10-27 11:09:37 EDT
I found a case where native git finds conflicts and egit reports it can cleanly merge. I suspect this points at an error in the egit/jgit merge implementation.

I (using native git) merged the current egit origin/master (cb2e630b) into egit change 1692, patchset 1 (3e494ae2), this yields the following conflicts :


[d029788@wdfm00251943a egit (errorEditor)]$ git merge origin/master
Removing org.eclipse.egit.core/src/org/eclipse/egit/core/ResourceList.java
Auto-merging org.eclipse.egit.ui/plugin.properties
CONFLICT (content): Merge conflict in org.eclipse.egit.ui/plugin.properties
Auto-merging org.eclipse.egit.ui/plugin.xml
Auto-merging org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
CONFLICT (content): Merge conflict in org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
Auto-merging org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/EgitUiEditorUtils.java
CONFLICT (content): Merge conflict in org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/EgitUiEditorUtils.java
Auto-merging org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/CompareVersionsHandler.java
CONFLICT (content): Merge conflict in org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/CompareVersionsHandler.java
Auto-merging org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/ShowVersionsHandler.java
CONFLICT (content): Merge conflict in org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/ShowVersionsHandler.java
Removing org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java
Removing org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/RefreshPreferencesPage.java
Auto-merging org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
Automatic merge failed; fix conflicts and then commit the result.

Repeating the same merge using EGit (today's bleeding edge) succeeds without conflicts.
Comment 1 Michal Staruch CLA 2010-11-08 16:47:37 EST
Steps:
1. Start two test branches from master.
2. On each of the branches add a bit different version of same method.
3. Switch to master.
4. Merge test branch 1.
5. Merge test branch 2.

Result: no conflict reported, two versions of the same method in merged code on master (compilation error).

Expected result: conflict reported (using "git gui", as a reference).


Eclipse JDT 3.6.1, JGit 0.9.3, EGit 0.9.3.
Comment 2 Christian Halstrick CLA 2010-11-09 04:24:29 EST
I think there is a bug in JGit's merge algorithm. Before I can fix it there are some discussions about this topic on the mailing list. See here: http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg00752.html . In am confident that we have a solution in the next days.
Comment 3 Matthias Sohn CLA 2013-04-14 18:18:35 EDT
(In reply to comment #2)
> I think there is a bug in JGit's merge algorithm. Before I can fix it there
> are some discussions about this topic on the mailing list. See here:
> http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg00752.html . In am
> confident that we have a solution in the next days.

any update on this ?
Comment 4 Shivam Shukla CLA 2016-09-15 11:23:20 EDT
I am facing the same problem.

Any update on this????
Comment 5 Christian Halstrick CLA 2016-09-16 03:44:34 EDT
the concrete problem reported in the first comment is solved. When todays jgit merges in the egit repo the commits cb2e630b and  3e494ae2 then it reports conflicts.
But of course there may be other situations where E/JGit and native git behave differently. Whether and where conflicts exists is far less clear then many people expect. The question what is the minimal diff between content1 and content2 is cannot be solved always with a single correct answer. And because of that also the conflicts computed may be different based on the diff algorithm the git client uses.
But, of course, our goal is to be as near to native git's behavior as possible. If JGit reports no conflicts where native git does I suspect a bug in JGit. If we behave differently than native git please report that and of course it's great if you have a reproduce able example for us.
Comment 6 Christian Halstrick CLA 2016-09-16 11:27:29 EDT
The concrete bug reported in the first command was fixed long ago. Let's close this bug and discuss similar issues (e.g. 501513) separately.