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

Bug 350880

Summary: NPE resetting branch resulting in an unusable state
Product: [Technology] EGit Reporter: Oleg Besedin <ob1.eclipse>
Component: CoreAssignee: Matthias Sohn <matthias.sohn>
Status: RESOLVED DUPLICATE QA Contact:
Severity: critical    
Priority: P3 CC: daniel_megert, malaperle, matthias.sohn, pawel.1.piech, pwebster, remy.suen, robin.rosenberg
Version: 1.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Oleg Besedin CLA 2011-06-30 15:52:43 EDT
1. Clone repo git.eclipse.org/gitroot/platform/eclipse.platform.ui.git using "master" initial branch
2. Import all projects
3. Close some projects, say, "org.eclipse.ui.carbon", "org.eclipse.ui.cocoa"
4. Team -> Reset, select Remote Tracking -> origin/R3_6_maintenance; "Hard" 
5. NPE exception resulting is what seems to be mixed result (some files on master, some on maintenance branch):

An internal error occurred during: "Resetting to refs/remotes/origin/R3_6_maintenance".
java.lang.NullPointerException

java.lang.NullPointerException
	at org.eclipse.jgit.dircache.DirCacheCheckout.processEntry(DirCacheCheckout.java:358)
	at org.eclipse.jgit.dircache.DirCacheCheckout.prescanOneTree(DirCacheCheckout.java:282)
	at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:382)
	at org.eclipse.egit.core.op.ResetOperation.checkoutIndex(ResetOperation.java:250)
	at org.eclipse.egit.core.op.ResetOperation.reset(ResetOperation.java:138)
	at org.eclipse.egit.core.op.ResetOperation.access$0(ResetOperation.java:115)
	at org.eclipse.egit.core.op.ResetOperation$1.run(ResetOperation.java:105)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
	at org.eclipse.egit.core.op.ResetOperation.execute(ResetOperation.java:109)
	at org.eclipse.egit.ui.internal.job.JobUtil$1.run(JobUtil.java:50)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Marc-André Laperle CLA 2011-07-12 01:07:08 EDT
I have a similar trace resetting CDT master

java.lang.NullPointerException
	at org.eclipse.jgit.dircache.DirCacheCheckout.processEntry(DirCacheCheckout.java:358)
	at org.eclipse.jgit.dircache.DirCacheCheckout.prescanOneTree(DirCacheCheckout.java:282)
	at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:392)
	at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:379)
	at org.eclipse.egit.core.op.ResetOperation.checkoutIndex(ResetOperation.java:250)
	at org.eclipse.egit.core.op.ResetOperation.reset(ResetOperation.java:138)
	at org.eclipse.egit.core.op.ResetOperation.access$0(ResetOperation.java:115)
	at org.eclipse.egit.core.op.ResetOperation$1.run(ResetOperation.java:105)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
	at org.eclipse.egit.core.op.ResetOperation.execute(ResetOperation.java:109)
	at org.eclipse.egit.ui.internal.job.JobUtil$1.run(JobUtil.java:50)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 2 Remy Suen CLA 2011-07-18 14:53:57 EDT
Just got hit by this. Dupe of bug 347574?
Comment 3 Pawel Piech CLA 2011-09-28 17:21:41 EDT
Got it also while performing a rebase of a local branch.  I'm on egit 1.1
Comment 4 Matthias Sohn CLA 2011-09-30 18:50:17 EDT
I tried this with the current nightly version and couldn't reproduce this problem, could you also retry with latest nightly ?
Comment 5 Dani Megert CLA 2011-10-06 07:14:34 EDT
I also ran into this. I could not find a workaround except deleting and cloning the whole large repo again. This is with 1.2.0.201110021920.
Comment 6 Dani Megert CLA 2011-10-06 07:49:23 EDT
It looks like the trigger for this bug is a file deletion from which one cannot recover.
Comment 7 Remy Suen CLA 2011-10-06 07:57:00 EDT
(In reply to comment #6)
> It looks like the trigger for this bug is a file deletion from which one cannot
> recover.

This seems similar to the steps described by comment 347574.
Comment 8 Pawel Piech CLA 2011-10-07 11:23:59 EDT
(In reply to comment #5)
> I also ran into this. I could not find a workaround except deleting and cloning
> the whole large repo again. This is with 1.2.0.201110021920.

I managed to recover by performing a hard reset from command line, then deleting and re-importing repo from Egit.  I did lose some changes in my local branch though.
Comment 9 Matthias Sohn CLA 2011-10-09 18:49:56 EDT
The NPE is clearly caused by a bug:
i.getDirCacheEntry() is null if DirCacheBuildIterator i is positioned on a tree -> this causes NPE
Comment 10 Matthias Sohn CLA 2011-10-11 17:28:13 EDT
Pushed http://egit.eclipse.org/r/4345 for review to prevent the NPE. 

I still couldn't reproduce the issue hence I am not completely sure if this will fix the root cause or just cure the symptom. I tried on Mac so far, maybe we only hit this on Windows so we will try to reproduce on Windows as a next step.
Comment 11 Robin Rosenberg CLA 2011-10-16 07:09:14 EDT
See http://egit.eclipse.org/r/#change,4357
Comment 12 Robin Rosenberg CLA 2011-10-16 16:05:47 EDT
I think this is a duplicate of 347574
Comment 13 Robin Rosenberg CLA 2011-10-17 17:31:09 EDT
This was identified as the same issue as in 347574.

*** This bug has been marked as a duplicate of bug 347574 ***