threads / patch / 19164

patchMicro optimise getting ignored status of a resource

Subject: [EGIT PATCH 1/1] Micro optimise getting ignored status of a resource

## tl;dr

One message between May 3, 2009 and May 3, 2009. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Ferry Huberts· May 3, 2009, 08:41 UTC · lore

Do not evaluate getting the ignored status of a resource twice when once is enough.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 .../org/spearce/egit/core/op/TrackOperation.java   |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Show changes to org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java +3 −2
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 29b4344..5f80698 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 isIgnored = Team.isIgnoredHint(resource);
 									if (resource.getType() == IResource.FILE) {
 										Entry entry = index.getEntry(repoPath);
-										if (!Team.isIgnoredHint(resource) || entry != null && entry.isAssumedValid()) {
+										if (!isIgnored || entry != null && entry.isAssumedValid()) {
 											entry = index.add(rm.getWorkDir(), new File(rm.getWorkDir(), repoPath));
 											entry.setAssumeValid(false);
 										}
 									}
-									if (Team.isIgnoredHint(resource))
+									if (isIgnored)
 										return false;
 
 								} catch (IOException e) {
-- 
1.6.0.6

← back to recent threads