From acac1d77b51f1ac11401cb6d35de59aba08a91be Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 12 Mar 2008 20:06:23 -0400 Subject: [PATCH] Evaluate RevFilters before inserting parent commits to pending By filtering up front we better position ourselves to avoid expensive parent rewrite related work when the commit is of no interest to the application. Currently there is no logic or performance impact to this change, but it relocates the filter earlier and provides a nicer structure to insert parent rewriting logic prior to injecting them into our pending queue. Signed-off-by: Shawn O. Pearce --- .../org/spearce/jgit/revwalk/AbstractPendingGenerator.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractPendingGenerator.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractPendingGenerator.java index f7bf496c..19cd41b3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractPendingGenerator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractPendingGenerator.java @@ -55,6 +55,14 @@ class AbstractPendingGenerator extends Generator { if (c == null) return null; + final boolean produce; + if ((c.flags & RevWalk.UNINTERESTING) != 0) + produce = false; + else if (filter.include(walker, c)) + produce = true; + else + produce = false; + final int carry = c.flags & RevWalk.CARRY_MASK; for (final RevCommit p : c.parents) { p.flags |= carry; @@ -72,10 +80,8 @@ class AbstractPendingGenerator extends Generator { continue; } - if (!filter.include(walker, c)) - continue; - - return c; + if (produce) + return c; } } catch (StopWalkException swe) { pending.clear(); -- 2.11.4.GIT