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

Bug 352243

Summary: IllegalStateException on commit due to missing MERGE_MSG file
Product: [Technology] EGit Reporter: Steffen Pingel <steffen.pingel>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: b.muskalla, jens.baumgart, matthias.sohn
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Steffen Pingel CLA 2011-07-15 13:57:21 EDT
When I try to commit EGit fails silently and logs the error below. I am using EGit 1.0.


Exception Stack Trace:
java.lang.IllegalStateException: java.io.FileNotFoundException: /home/spingel/mylyn/src-3_6_x/org.eclipse.mylyn.tasks/.git/MERGE_MSG (No such file or directory)
	at org.eclipse.egit.ui.internal.commit.CommitHelper.getMergeResolveMessage(CommitHelper.java:142)
	at org.eclipse.egit.ui.internal.commit.CommitHelper.calculateCommitInfo(CommitHelper.java:97)
	at org.eclipse.egit.ui.internal.commit.CommitHelper.<init>(CommitHelper.java:65)
	at org.eclipse.egit.ui.internal.commit.CommitUI.commit(CommitUI.java:146)
	at org.eclipse.egit.ui.internal.repository.tree.command.CommitCommand.execute(CommitCommand.java:31)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.io.FileNotFoundException: /home/spingel/mylyn/src-3_6_x/org.eclipse.mylyn.tasks/.git/MERGE_MSG (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at java.io.FileReader.<init>(FileReader.java:55)
	at org.eclipse.egit.ui.internal.commit.CommitHelper.getMergeResolveMessage(CommitHelper.java:123)
	... 38 more
Comment 1 Jens Baumgart CLA 2011-07-19 11:44:18 EDT
As a workaround you can recreate the file MERGE_MSG in the .git folder. Of cource the content is lost but you are able to commit.


Fix proposed (improved error handling and error tolerance)

http://egit.eclipse.org/r/3897
http://egit.eclipse.org/r/3900
Comment 2 Steffen Pingel CLA 2011-08-12 06:54:35 EDT
Why would I need to create this file? I would like to get EGit out of this bogus state instead of working around exceptions.
Comment 3 Steffen Pingel CLA 2011-08-16 10:40:30 EDT
I resolved it by deleting .git/CHERRY_PICK_HEAD (don't know where that came from). Now the label decoration in the Git Repositories view shows "[master]" again and not "[master - Merged]". I can now work with the repository from EGit again.
Comment 4 Matthias Sohn CLA 2011-09-05 02:58:18 EDT
merged as b63da7f30df4aff5f983f44fbdc4847dffb12997

Closing this issue as nobody seems to be able to reproduce what caused missing MERGE_MSG. The improved error handling should help if this happens again.