Bug 388914 - Egit throws exception when remote tracking branch points to unknown commit.
Summary: Egit throws exception when remote tracking branch points to unknown commit.
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-06 04:15 EDT by Steen Brahe CLA
Modified: 2012-09-06 04:57 EDT (History)
2 users (show)

See Also:


Attachments
Screen dump of Git perspective with no decorations and list of errors (205.39 KB, image/png)
2012-09-06 04:15 EDT, Steen Brahe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steen Brahe CLA 2012-09-06 04:15:19 EDT
Created attachment 220771 [details]
Screen dump of Git perspective with no decorations and list of errors

Hi,

We have found a bug in EGit/JGit. 
We have a number of developers using Eclipse Juno and a shared remote repository accessed through the file protocol.
Now, the remote repository has in some yet unknown way come into an invalid state. The remote tracking branch (origin/master) points to a commit that does not exist.
We are still examining how this could happen, and if you have ideas we would very much like to hear about it.
However, the bug to report here is, that the EGit throws an exception when we checkout the local master branch. It is caused by the exception org.eclipse.jgit.errors.MissingObjectException, and the error log only says it cannot find a specific commit. See stack trace below. Actually several egit exceptions are thrown at the same time, probably because the UI is being updated several places.
This exception occurs when the remote tracking branch points to unknown commits, and also when tags points to unknown commits.
The history view cannot be viewed as well. An IllegalStateException is thrown: Cannot set start points for repository.

It might not be possible to handle a repository in an invalid state well, but better information about the problem would be appreciated, for instance showing a popup. It took quite a while to figure out that is was the remote tracking branches and tags that where the problem.

I have attached a screendump of the git repository perspective

Steen Brahe

Stacktrace:
org.eclipse.core.runtime.CoreException: Errors occurred while applying Git decorations to resources.
     at org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator.decorateResource(GitLightweightDecorator.java:193)
     at org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator.decorate(GitLightweightDecorator.java:167)
     at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:263)
     at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:81)
     at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
     at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:365)
     at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:347)
     at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:370)
     at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:330)
     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 11f241f45268c13d380061b099a5f0c84879398b
     at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:125)
     at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:228)
     at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:812)
     at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:725)
     at org.eclipse.jgit.lib.BranchTrackingStatus.of(BranchTrackingStatus.java:90)
     at org.eclipse.egit.ui.internal.decorators.DecoratableResourceHelper.getBranchStatus(DecoratableResourceHelper.java:48)
     at org.eclipse.egit.ui.internal.decorators.DecoratableResourceAdapter.<init>(DecoratableResourceAdapter.java:65)
     at org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator.decorateResource(GitLightweightDecorator.java:191)
     ... 9 more
Comment 1 Robin Stocker CLA 2012-09-06 04:57:00 EDT
The History view was already changed to handle such cases (to be released in 2.1):

https://git.eclipse.org/c/egit/egit.git/commit/?id=8425aaa3874ba87b7a2e4eb3960a23eed3c17523

DecoratableResourceHelper should also handle this case.

In general, it may be worth to add some "diagnostics" information to the new statistics page of a git repository (added in fd470c4255574d446b14fc9b9fe350d2fc057911).