summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJens Baumgart2010-08-02 11:02:28 (EDT)
committer Chris Aniszczyk2010-08-02 11:45:22 (EDT)
commitfa7caf467ea4d031e0b996ba65218e8724a1d630 (patch)
tree6527cea2bbc6fecc945f5c64a606bfa999227b51
parent2007b7331206ad502f0c7acb54b85f00a880f929 (diff)
downloadegit-fa7caf467ea4d031e0b996ba65218e8724a1d630.zip
egit-fa7caf467ea4d031e0b996ba65218e8724a1d630.tar.gz
egit-fa7caf467ea4d031e0b996ba65218e8724a1d630.tar.bz2
Exclude ignored resources from decorationrefs/changes/08/1208/3
Resources are now excluded from decoration if they match a specification in .gitignore. Change-Id: Ic018b303eb8b5d81eded9363ac074d387530e3ce Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java39
1 files changed, 21 insertions, 18 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java
index f9e61ac..aa7362c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java
@@ -46,7 +46,6 @@ import org.eclipse.jgit.treewalk.WorkingTreeIterator;
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
-import org.eclipse.team.core.Team;
class DecoratableResourceAdapter implements IDecoratableResource {
@@ -134,7 +133,7 @@ class DecoratableResourceAdapter implements IDecoratableResource {
return repository.getBranch();
}
- private void extractResourceProperties(TreeWalk treeWalk) {
+ private void extractResourceProperties(TreeWalk treeWalk) throws IOException {
final ContainerTreeIterator workspaceIterator = treeWalk.getTree(
T_WORKSPACE, ContainerTreeIterator.class);
final ResourceEntry resourceEntry = workspaceIterator != null ? workspaceIterator
@@ -143,7 +142,7 @@ class DecoratableResourceAdapter implements IDecoratableResource {
if (resourceEntry == null)
return;
- if (isIgnored(resourceEntry.getResource())) {
+ if (workspaceIterator != null && workspaceIterator.isEntryIgnored()) {
ignored = true;
return;
}
@@ -209,9 +208,24 @@ class DecoratableResourceAdapter implements IDecoratableResource {
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
- if (treeWalk.getFileMode(T_HEAD) == FileMode.MISSING
- && treeWalk.getFileMode(T_INDEX) == FileMode.MISSING)
- return false;
+ final WorkingTreeIterator workingTreeIterator = treeWalk.getTree(
+ T_WORKSPACE, WorkingTreeIterator.class);
+ if (workingTreeIterator instanceof ContainerTreeIterator) {
+ final ContainerTreeIterator workspaceIterator = treeWalk.getTree(
+ T_WORKSPACE, ContainerTreeIterator.class);
+ if (workspaceIterator != null) {
+ ResourceEntry resourceEntry = workspaceIterator
+ .getResourceEntry();
+ if (resource.equals(resourceEntry.getResource())
+ && workspaceIterator.isEntryIgnored()) {
+ ignored = true;
+ return false;
+ }
+ }
+ }
+ // Note: for obtaining the ignored info we have to go through the
+ // whole working tree and can no longer cut here if the current
+ // entry is not contained in the index and not contained in head
if (FileMode.TREE.equals(treeWalk.getRawMode(T_WORKSPACE)))
return shouldRecurse(treeWalk);
@@ -235,7 +249,7 @@ class DecoratableResourceAdapter implements IDecoratableResource {
return false;
}
- private boolean shouldRecurse(TreeWalk treeWalk) {
+ private boolean shouldRecurse(TreeWalk treeWalk) throws IOException {
final WorkingTreeIterator workspaceIterator = treeWalk.getTree(
T_WORKSPACE, WorkingTreeIterator.class);
@@ -283,12 +297,6 @@ class DecoratableResourceAdapter implements IDecoratableResource {
}
private void extractContainerProperties(TreeWalk treeWalk) throws IOException {
-
- if (isIgnored(resource)) {
- ignored = true;
- return;
- }
-
treeWalk.setFilter(AndTreeFilter.create(treeWalk.getFilter(),
new RecursiveStateFilter()));
treeWalk.setRecursive(true);
@@ -367,11 +375,6 @@ class DecoratableResourceAdapter implements IDecoratableResource {
return treeWalk;
}
- private static boolean isIgnored(IResource resource) {
- // TODO: Also read ignores from .git/info/excludes et al.
- return Team.isIgnoredHint(resource);
- }
-
public String getName() {
return resource.getName();
}