git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT] [PATCH RFC v1 3/5] Optimise ignore evaluation

From
Ferry Huberts <ferry.huberts@pelagic.nl>
Date
Mar 26, 2009, 21:34 UTC
Message-ID
<e9605b0b1bda26f568009a42b31220d60692fce6.1238102327.git.ferry.huberts@pelagic.nl>
In-Reply-To
<77afc036be3e7704333130c1cd2ab28466a91e67.1238102327.git.ferry.huberts@pelagic.nl>

Do not call GitIgnoreData.isIgnored(resource) multiple times when not needed.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 .../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
Previous: Ferry HubertsNext: Ferry Huberts
Message 4 of 16 in “Add (static) ignore functionality to EGit”
  1. Ferry HubertsMar 26, 2009
  2. [EGIT] [PATCH RFC v1 1/5] Build up the ignore patterns cache upon workspace startup.Ferry Huberts, Mar 26, 2009
  3. [EGIT] [PATCH RFC v1 2/5] Enable the ignore handling of the pluginFerry Huberts, Mar 26, 2009
  4. [EGIT] [PATCH RFC v1 3/5] Optimise ignore evaluationFerry Huberts, Mar 26, 2009
  5. [EGIT] [PATCH RFC v1 4/5] Do not set .git as a Team ignore patternFerry Huberts, Mar 26, 2009
  6. [EGIT] [PATCH RFC v1 5/5] Use the ignore patterns cache to determine ignoresFerry Huberts, Mar 26, 2009
  7. Robin RosenbergMar 29, 2009
  8. Ferry Huberts (Pelagic)Mar 29, 2009
  9. Shawn O. PearceMar 30, 2009
  10. Jonathan GossageMar 30, 2009
  11. Robin RosenbergMar 30, 2009
  12. Shawn O. PearceApr 5, 2009
  13. Ferry Huberts (Pelagic)Apr 6, 2009
  14. Ferry Huberts (Pelagic)Apr 6, 2009
  15. Shawn O. PearceApr 6, 2009
  16. Sverre RabbelierApr 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.