]> source.dussan.org Git - jgit.git/commitdiff
Revert "Stop PathFilter after walking all matching paths" 13/9413/1
authorShawn Pearce <sop@google.com>
Tue, 1 Jan 2013 17:25:26 +0000 (12:25 -0500)
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>
Tue, 1 Jan 2013 17:25:26 +0000 (12:25 -0500)
This reverts commit 75eb6a147ffa8089e48d409f0215a16c755305e7.
Applications that want a PathFilter to abort the walk early should be
using PathFilterGroup. When a PathFilterGroup is created with exactly
one path its implementation is the same that 75eb6 tried to perform,
but has been long documented as having the behavior of breaking a
higher level OR filter graph node.

Change-Id: I6c85d75c474784471c32e866eef3402b9f193c08

org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java

index 365a820981d673e1555b527cf0d59ed7e79cafd7..d85ea8cc5dee83a85e570527a73bd910677cd83c 100644 (file)
@@ -44,7 +44,6 @@
 
 package org.eclipse.jgit.treewalk.filter;
 
-import org.eclipse.jgit.errors.StopWalkException;
 import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.treewalk.TreeWalk;
@@ -98,10 +97,7 @@ public class PathFilter extends TreeFilter {
 
        @Override
        public boolean include(final TreeWalk walker) {
-               int cmp = walker.isPathPrefix(pathRaw, pathRaw.length);
-               if (cmp > 0)
-                       throw StopWalkException.INSTANCE;
-               return cmp == 0;
+               return walker.isPathPrefix(pathRaw, pathRaw.length) == 0;
        }
 
        @Override