diff options
author | Chris Aniszczyk | 2010-09-02 00:39:40 +0000 |
---|---|---|
committer | Code Review | 2010-09-02 00:39:41 +0000 |
commit | 7a504b8d7cf7a329774993ea94776a76886e4017 (patch) | |
tree | 032aff5fd96976b5fc182ee9451c085ca6875362 | |
parent | 38327a54a86697458a1b326278e04833c105c00e (diff) | |
parent | 028a613ced7a8cc935f0f8154b8f5a54509c1e12 (diff) | |
download | jgit-7a504b8d7cf7a329774993ea94776a76886e4017.tar.gz jgit-7a504b8d7cf7a329774993ea94776a76886e4017.tar.xz jgit-7a504b8d7cf7a329774993ea94776a76886e4017.zip |
Merge "Add toString and improve Javadoc of NotIgnoredFilter"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java index 122ce40344..2e96d2ffa4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java @@ -50,32 +50,26 @@ import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.WorkingTreeIterator; /** - * This filter includes workdir entries that are not ignored. This class is - * immutable. + * Skip {@link WorkingTreeIterator} entries that appear in gitignore files. */ public class NotIgnoredFilter extends TreeFilter { - - private final int workdirTreeIndex; + private final int index; /** - * constructor + * Construct a filter to ignore paths known to a particular iterator. * * @param workdirTreeIndex * index of the workdir tree in the tree walk */ public NotIgnoredFilter(final int workdirTreeIndex) { - this.workdirTreeIndex = workdirTreeIndex; + this.index = workdirTreeIndex; } @Override - public boolean include(TreeWalk walker) throws MissingObjectException, + public boolean include(TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, IOException { - WorkingTreeIterator workingTreeIterator = walker.getTree( - workdirTreeIndex, WorkingTreeIterator.class); - if (workingTreeIterator != null) - // do not include ignored entries - return !workingTreeIterator.isEntryIgnored(); - return true; + WorkingTreeIterator i = tw.getTree(index, WorkingTreeIterator.class); + return i == null || !i.isEntryIgnored(); } @Override @@ -89,4 +83,8 @@ public class NotIgnoredFilter extends TreeFilter { return this; } + @Override + public String toString() { + return "NotIgnored(" + index + ")"; + } } |