Community
Participate
Working Groups
1) Created a (custom) project 2) Project is containing a virtual Folder and file 3) Choose in Context menu: Teams->Share Project... 4) Chose git 5) Create a local repo 6) Click finish The project has a folder {MyProject}/.internal which is a Virtual IRessources which is derived. In org.eclipse.egit.core.op.ConnectProviderOperation.connectProject() the method autoIgnoreDerivedResources() is called which is parsing the project tree for derived folders and trying to get the path of it. It's for creating the .gitignore file. But for Virtual folders there is no path so the exception is thrown. Could be solved by ConnectProviderOperation.findDerivedResources() and add a check to skip virtual IRessources like: private List<IPath> findDerivedResources(IContainer c) throws CoreException { List<IPath> derived = new ArrayList<IPath>(); IResource[] members = c.members(IContainer.INCLUDE_HIDDEN); for (IResource r : members) { if (r.isDerived() && !r.isVirtual()) derived.add(r.getLocation()); else if (r instanceof IContainer && !r.isVirtual()) derived.addAll(findDerivedResources((IContainer) r)); } return derived; } the thrown Exception: java.lang.NullPointerException: undefined at org.eclipse.core.runtime.Path.isPrefixOf(Path.java:708) at org.eclipse.core.internal.localstore.FileSystemResourceManager.resourceForLocation(FileSystemResourceManager.java:307) at org.eclipse.core.internal.localstore.FileSystemResourceManager.fileForLocation(FileSystemResourceManager.java:487) at org.eclipse.core.internal.resources.WorkspaceRoot.getFileForLocation(WorkspaceRoot.java:115) at org.eclipse.egit.core.internal.util.ResourceUtil.getFileForLocation(ResourceUtil.java:128) at org.eclipse.egit.core.internal.util.ResourceUtil.getResourceForLocation(ResourceUtil.java:103) at org.eclipse.egit.core.internal.job.RuleUtil.getRuleForContainers(RuleUtil.java:108) at org.eclipse.egit.core.op.IgnoreOperation.calcSchedulingRule(IgnoreOperation.java:342) at org.eclipse.egit.core.op.IgnoreOperation.<init>(IgnoreOperation.java:76) at org.eclipse.egit.core.op.ConnectProviderOperation.autoIgnoreDerivedResources(ConnectProviderOperation.java:243) at org.eclipse.egit.core.op.ConnectProviderOperation.connectProject(ConnectProviderOperation.java:190) at org.eclipse.egit.core.op.ConnectProviderOperation.execute(ConnectProviderOperation.java:111) at org.eclipse.egit.ui.internal.sharing.SharingWizard$1.run(SharingWizard.java:133) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/200212
Gerrit change https://git.eclipse.org/r/c/egit/egit/+/200212 was merged to [master]. Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=5e0c006b3733a0dafde0495123b418329f487e06
Wow, super fast. Thanks!
(In reply to Stefan Fussenegger from comment #3) > Wow, super fast. Thanks! This was easy since you provided the patch :-) Next time you can try pushing the fix to Gerrit yourself, see the contributor guide at https://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches