Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327573 - Internal error merging
Summary: Internal error merging
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 0.10.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 1.2   Edit
Assignee: Matthias Sohn CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 339531 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-12 11:44 EDT by Doug Schaefer CLA
Modified: 2011-12-15 11:50 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Schaefer CLA 2010-10-12 11:44:36 EDT
I got the following internal error trying to merge. I'm having real problems with merge. This merge should have been simple. I'm worried that my local repo is corrupted.

eclipse.buildId=M20100909-0800
java.version=1.6.0_21
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86 -data C:\Eclipse\workspaces\quattro


Error
Tue Oct 12 11:41:00 EDT 2010
An internal error occurred during: "Merging with refs/remotes/origin/talos".

org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of merge command. org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with files: 
tests/test-all
	at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:221)
	at org.eclipse.egit.core.op.MergeOperation$1.run(MergeOperation.java:102)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
	at org.eclipse.egit.core.op.MergeOperation.execute(MergeOperation.java:122)
	at org.eclipse.egit.ui.internal.actions.MergeActionHandler$1.run(MergeActionHandler.java:66)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with files: 
tests/test-all
	at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:316)
	at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:162)
	... 6 more
Comment 1 Chris Aniszczyk CLA 2010-10-12 11:50:47 EDT
pretty sure not all conflicts weren't resolved in "tests/test-all"
Comment 2 Doug Schaefer CLA 2010-10-12 14:07:59 EDT
(In reply to comment #1)
> pretty sure not all conflicts weren't resolved in "tests/test-all"

If I had Compare between branches, I'd be able to tell ;).

I committed and pushed my changes to my talos branch and then did the merge from master in a different repo managed by msysgit and pushed the resulting talos branch back. It should just be a fast forward when I fetch and merge in egit, no?
Comment 3 Christian Halstrick CLA 2010-10-26 05:08:17 EDT
I looked it up in the code and when I understand your use-case correctly then
this looks like your local file tests/test-all contained changes not yet known
to jgit. And during merge jgit doesn't want to overwrite your local changes and
therefore comes up with an error.

Is there any chance that I can replay what you have done? Are the two commit you
want to merge are already available somewhere? Or is it reproduceable (e.g. clone repo x, branch of at commit xyz and modify file <myFile.txt>. Merge with branch <other>)
Comment 4 James Blackburn CLA 2011-03-10 09:48:51 EST
*** Bug 339531 has been marked as a duplicate of this bug. ***
Comment 5 James Blackburn CLA 2011-03-10 09:51:57 EST
This is fairly straightforward to reproduce.

1) Create a simple repo with 2-branches
2) Change a file and commit on one branch
3) Change to the other branch
4) Change the same file (and add, if you want)
5) Attempt to perform the merge.

At step 5 an internal error dialog will pop-up and two errors will be logged to the error log.

Egit should helpfully prompt the user in this case like cgit does:

bash:jamesb:xl-cbga-20:32816> git merge branch1
Updating d1cfbf6..59a7ae8
error: Your local changes to 'asdf2' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.
Comment 6 Stephan Herrmann CLA 2011-10-13 07:40:26 EDT
I'm seeing a similar error logged (reproducably):

EGit: 1.1.0
Operation: Pull (branch is configured to rebase)
Workspace has uncommitted changes.

While it is correct to raise an issue I believe it is wrong to signal this
with an Exception / Error Dialog / Log Entry.

This is a normal use-case for which users should be given help as mentioned 
in comment 5 instead of raising alarms that something is terribly broken.
Comment 7 Matthias Sohn CLA 2011-11-26 18:35:42 EST
Pushed patches for review:
JGit: http://egit.eclipse.org/r/#change,4682
EGit: http://egit.eclipse.org/r/4683
Comment 8 Matthias Sohn CLA 2011-12-11 16:57:26 EST
merged as 8cb9c21bafa3c6784cb5ed73205a1f3505957893
Comment 9 Tomasz Zarna CLA 2011-12-15 11:50:22 EST
(In reply to comment #6)
> While it is correct to raise an issue I believe it is wrong to signal this
> with an Exception / Error Dialog / Log Entry.
> 
> This is a normal use-case for which users should be given help as mentioned 
> in comment 5 instead of raising alarms that something is terribly broken.

I totally agree with Stephan. Throwing an exception seems to be to much. Why not return a MergeResult object with MergeFailureReason.DIRTY_WORKTREE as suggested in bug 356918 (http://egit.eclipse.org/r/#change,4177)?

(In reply to comment #8)
> merged as 8cb9c21bafa3c6784cb5ed73205a1f3505957893

I can't find it. Is it 26b5738?

BTW, this change broke Orion, see bug 366818. So it's another example of an API breakage -- http://dev.eclipse.org/mhonarc/lists/egit-dev/msg02498.html.