Do not call GitIgnoreData.isIgnored(resource) multiple times when not needed. Signed-off-by: Ferry Huberts <ferry.huberts@xxxxxxxxxx> --- .../org/spearce/egit/core/op/TrackOperation.java | 5 +++-- .../decorators/DecoratableResourceAdapter.java | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java index 4a4b93c..a64c1dd 100644 --- a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java +++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java @@ -94,14 +94,15 @@ public boolean visit(IResource resource) throws CoreException { // first. If a resource within a ignored folder is marked // we ignore it here, i.e. there is no way to unmark it expect // by explicitly selecting and invoking track on it. + boolean ignored = GitIgnoreData.isIgnored(resource); if (resource.getType() == IResource.FILE) { Entry entry = index.getEntry(repoPath); - if (!GitIgnoreData.isIgnored(resource) || ((entry != null) && entry.isAssumedValid())) { + if (!ignored || ((entry != null) && entry.isAssumedValid())) { entry = index.add(rm.getWorkDir(), new File(rm.getWorkDir(), repoPath)); entry.setAssumeValid(false); } } - if (GitIgnoreData.isIgnored(resource)) + if (ignored) return false; } catch (IOException e) { diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java index 4c740d5..7b48fd8 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java @@ -118,7 +118,7 @@ private void extractResourceProperties(TreeWalk treeWalk) { if (resourceEntry == null) return; - if (isIgnored(resourceEntry.getResource())) { + if (GitIgnoreData.isIgnored(resourceEntry.getResource())) { ignored = true; return; } @@ -261,7 +261,7 @@ public boolean shouldBeRecursive() { private void extractContainerProperties(TreeWalk treeWalk) throws IOException { - if (isIgnored(resource)) { + if (GitIgnoreData.isIgnored(resource)) { ignored = true; return; } @@ -361,11 +361,6 @@ private static boolean timestampMatches(DirCacheEntry indexEntry, } } - private static boolean isIgnored(IResource resource) { - // TODO: Also read ignores from .git/info/excludes et al. - return GitIgnoreData.isIgnored(resource); - } - public String getName() { return resource.getName(); } -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html