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

Bug 352692

Summary: Egit confused after copy and replacing files
Product: [Technology] EGit Reporter: Benjamin Muskalla <b.muskalla>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: robin.rosenberg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Benjamin Muskalla CLA 2011-07-20 23:19:49 EDT
Steps:
* Clone ssh://git.eclipse.org/gitroot/mpc/org.eclipse.epp.mpc.git
* Import *org.eclipse.epp.mpc.feature*  and *org.eclipse.epp.mpc.source.feature* 
* Copy license.html from feature to source feature, overwriting the existing file

Problems
* Wrong decorator, file should just be changed
* Trying to replace the file with the HEAD versions leads to the following exception


java.lang.IllegalArgumentException: FileMode not set for path org.eclipse.epp.mpc.source.feature/license.html
	at org.eclipse.jgit.dircache.DirCacheEditor.applyEdits(DirCacheEditor.java:154)
	at org.eclipse.jgit.dircache.DirCacheEditor.finish(DirCacheEditor.java:122)
	at org.eclipse.jgit.dircache.BaseDirCacheEditor.commit(BaseDirCacheEditor.java:197)
	at org.eclipse.jgit.dircache.DirCacheEditor.commit(DirCacheEditor.java:117)
	at org.eclipse.jgit.api.CheckoutCommand.checkoutPaths(CheckoutCommand.java:265)
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:128)
	at org.eclipse.egit.core.op.DiscardChangesOperation.discardChange(DiscardChangesOperation.java:175)
	at org.eclipse.egit.core.op.DiscardChangesOperation.discardChanges(DiscardChangesOperation.java:132)
	at org.eclipse.egit.core.op.DiscardChangesOperation.access$0(DiscardChangesOperation.java:116)
	at org.eclipse.egit.core.op.DiscardChangesOperation$1.run(DiscardChangesOperation.java:109)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.egit.core.op.DiscardChangesOperation.execute(DiscardChangesOperation.java:112)
	at org.eclipse.egit.ui.internal.actions.DiscardChangesActionHandler$1.run(DiscardChangesActionHandler.java:47)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Robin Rosenberg CLA 2013-01-04 13:20:25 EST
Eclipse deletes files during copy. There is no way we can know that it's
just a temporary delete. 

Maybe we should drop the hook and detect the deletion only on commit. I think that would be quite ok. The current behavior stems from at long time back when the commit dialog was more stupid, and there was no staging view