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

Bug 358901

Summary: Support filtered resources (they are considered as deleted in Staging view, Commit Dialog)
Product: [Technology] EGit Reporter: Alexandre Garnier <zigarn+eclipse>
Component: CoreAssignee: Robin Stocker <robin>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: caniszczyk, matthew, matthias.sohn, rainer.frey, remy.suen, robin, tex-hex
Version: 2.2Keywords: noteworthy
Target Milestone: 2.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Alexandre Garnier CLA 2011-09-26 10:19:13 EDT
Build Identifier: 

When filtering resources in projects, they are considered as deleted in 'Git Staging' view

Reproducible: Always

Steps to Reproduce:
1. Exclude some resources from project using 'contextual menu > Resource > Resource Filters'
2. Go to 'Git Staging' view
3. Excluded resources are considered as deleted
Comment 1 Alexandre Garnier CLA 2011-09-26 10:25:27 EDT
It is weirder when resources are in other project.

E.g. with this structure :
 module
  |- pom.xml
  `- sub-module
      `- pom.xml

With m2e, there is 2 projects 'module' and 'submodule', so to avoid content duplication, I exclude sub-module from 'module' project.

Result:
 - all sub-module content is considered as deleted in 'Git Staging' view
 - all sub-module content is considered as untracked (with a question mark) in 'Package' and 'Navigator' views and in 'Synchronize' view
Comment 2 Carsten W CLA 2012-07-17 07:42:21 EDT
Now I got the same problems since I upgraded EGit to Version 2.0. In Version 1.3 everything was fine.
Comment 3 Robin Stocker CLA 2012-07-24 06:07:37 EDT
The problem is in ContainerTreeIterator, here:

	private Entry[] entries() {
		final IResource[] all;
		try {
			all = node.members(IContainer.INCLUDE_HIDDEN);

members doesn't return filtered resources, so later they are reported as missing. I've found no API to get to the filtered resources.

Could anyone with knowledge of org.eclipse.core.resources help out?
Comment 4 Robin Stocker CLA 2012-11-28 08:00:33 EST
*** Bug 384102 has been marked as a duplicate of this bug. ***
Comment 5 Robin Stocker CLA 2012-12-01 18:22:41 EST
I looked into this and have pushed a solution to review:

https://git.eclipse.org/r/8989 (JGit)
https://git.eclipse.org/r/8990 (EGit)

It works well with an example nested project structure.

There are some possibly surprising things. E.g. when doing "Add to Index" on the root project, the sub projects are also affected. Maybe we need to make "Add to Index" smarter so that it traverses the resources itself and then only adds the resulting files via AddCommand. But that should not block the inclusion of above change.
Comment 6 Chris Aniszczyk CLA 2012-12-03 12:46:27 EST
jgit changed fix in master
Comment 7 Chris Aniszczyk CLA 2012-12-03 12:46:44 EST
oops, closed the bug w/o the egit changes
Comment 8 Matthias Sohn CLA 2012-12-05 18:15:59 EST
merged egit change as 0fa1895d31bcbee85e626c578d14b9b17324dd45