1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.treewalk.filter;
11
12 import java.io.IOException;
13
14 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
15 import org.eclipse.jgit.errors.MissingObjectException;
16 import org.eclipse.jgit.treewalk.TreeWalk;
17 import org.eclipse.jgit.treewalk.WorkingTreeIterator;
18
19
20
21
22
23 public class NotIgnoredFilter extends TreeFilter {
24 private final int index;
25
26
27
28
29
30
31
32 public NotIgnoredFilter(int workdirTreeIndex) {
33 this.index = workdirTreeIndex;
34 }
35
36
37 @Override
38 public boolean include(TreeWalk tw) throws MissingObjectException,
39 IncorrectObjectTypeException, IOException {
40 WorkingTreeIterator i = tw.getTree(index, WorkingTreeIterator.class);
41 return i == null || !i.isEntryIgnored();
42 }
43
44
45 @Override
46 public boolean shouldBeRecursive() {
47 return false;
48 }
49
50
51 @Override
52 public TreeFilter clone() {
53
54 return this;
55 }
56
57
58 @SuppressWarnings("nls")
59 @Override
60 public String toString() {
61 return "NotIgnored(" + index + ")";
62 }
63 }