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

Bug 327407

Summary: Committing a linked source fails
Product: [Technology] EGit Reporter: Gorkem Ercan <gorkem.ercan>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.org, robin.rosenberg
Version: unspecified   
Target Milestone: 2.3   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix - gerrit change supersedes this patch none

Description Gorkem Ercan CLA 2010-10-10 13:45:37 EDT
When I try to commit a project that has a linked source directory it fails with the following error..

eclipse.buildId=M20100909-0800
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.pulsar.product
Command-line arguments:  -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.pulsar.product


Error
Sun Oct 10 20:40:37 EEST 2010
Committing failed

org.eclipse.team.core.TeamException: Preparing trees
at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:173)
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.CommitOperation.execute(CommitOperation.java:192)
at org.eclipse.egit.ui.internal.actions.CommitActionHandler$2.run(CommitActionHandler.java:204)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.FileNotFoundException: (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.eclipse.jgit.lib.GitIndex$Entry.<init>(GitIndex.java:429)
at org.eclipse.jgit.lib.GitIndex.add(GitIndex.java:175)
at org.eclipse.egit.core.op.CommitOperation.prepareTrees(CommitOperation.java:259)
at org.eclipse.egit.core.op.CommitOperation.access$7(CommitOperation.java:199)
at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:166)
... 5 more
Comment 1 François Rey CLA 2011-06-05 09:50:46 EDT
A linked resource is basically a 'virtual' resource, its location in the Eclipse project does not correspond to the same location in the filesystem, but to somewhere else. That would explain the FileNotFoundException: there's not way it can be committed to git since it's not there in the filesystem.
This bug shows a lack of support for Linked Resources. EGit should show a proper warning instead of failing like that.
See Bug #333338.
Comment 2 François Rey CLA 2011-06-05 19:02:41 EDT
Created attachment 197370 [details]
Fix - gerrit change supersedes this patch

Simple patch that ensure linked resources are ignored in key points of egit core and ui logic.

I made this patch while resolving bug #347885, so another patch is attached there. These two patches should probably resolve a few bugs related to linked resources such as bug #333338 and bug #347454. They also solve the apparently unreported case where the EGit project sharing dialog lists repositories totally unrelated to the selected project when it contains linked folders pointing to files below another git repository.

Note that Eclipse docs state it is recommended for a Team
Provider to ignore linked resources, see section titled "Strategies for Handling Linked Resources" there:
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/team_resources.htm
Comment 3 François Rey CLA 2011-06-07 19:41:52 EDT
I've submitted the following change request for this bug:
http://egit.eclipse.org/r/3680
It fixes this bug, plus cover a few more areas where linked resources should be ignored.
This bug should be marked as a duplicate of the more generic bug #333338 where the change request is referenced.
Comment 4 Robin Rosenberg CLA 2013-03-15 18:47:43 EDT
Merged in 2.3.0