private Set<String> conflicts = new HashSet<String>();
+ private Set<String> ignored;
+
private Set<String> assumeUnchanged;
private DirCache dirCache;
if (filter != null)
filters.add(filter);
filters.add(new SkipWorkTreeFilter(INDEX));
- filters.add(new IndexDiffFilter(INDEX, WORKDIR));
+ IndexDiffFilter indexDiffFilter = new IndexDiffFilter(INDEX, WORKDIR);
+ filters.add(indexDiffFilter);
treeWalk.setFilter(AndTreeFilter.create(filters));
while (treeWalk.next()) {
AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
if (monitor != null)
monitor.endTask();
+ ignored = indexDiffFilter.getIgnoredPaths();
if (added.isEmpty() && changed.isEmpty() && removed.isEmpty()
&& missing.isEmpty() && modified.isEmpty()
&& untracked.isEmpty())
return conflicts;
}
+ /**
+ * The method returns the list of ignored files and folders. Only the root
+ * folder of an ignored folder hierarchy is reported. If a/b/c is listed in
+ * the .gitignore then you should not expect a/b/c/d/e/f to be reported
+ * here. Only a/b/c will be reported. Furthermore only ignored files /
+ * folders are returned that are NOT in the index.
+ *
+ * @return list of files / folders that are ignored
+ */
+ public Set<String> getIgnoredNotInIndex() {
+ return ignored;
+ }
+
/**
* @return list of files with the flag assume-unchanged
*/
package org.eclipse.jgit.treewalk.filter;
import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
private final boolean honorIgnores;
+ private final Set<String> ignoredPaths = new HashSet<String>();
+
/**
* Creates a new instance of this filter. Do not use an instance of this
* filter in multiple treewalks.
// other tree.
final int cnt = tw.getTreeCount();
final int dm = tw.getRawMode(dirCache);
+ WorkingTreeIterator wi = workingTree(tw);
if (dm == 0) {
- if (honorIgnores && workingTree(tw).isEntryIgnored()) {
+ if (honorIgnores && wi.isEntryIgnored()) {
+ ignoredPaths.add(wi.getEntryPathString());
int i = 0;
for (; i < cnt; i++) {
if (i == dirCache || i == workingTree)
// Only one chance left to detect a diff: between index and working
// tree. Make use of the WorkingTreeIterator#isModified() method to
// avoid computing SHA1 on filesystem content if not really needed.
- WorkingTreeIterator wi = workingTree(tw);
DirCacheIterator di = tw.getTree(dirCache, DirCacheIterator.class);
return wi.isModified(di.getDirCacheEntry(), true);
}
public String toString() {
return "INDEX_DIFF_FILTER";
}
+
+ /**
+ * The method returns the list of ignored files and folders. Only the root
+ * folder of an ignored folder hierarchy is reported. If a/b/c is listed in
+ * the .gitignore then you should not expect a/b/c/d/e/f to be reported
+ * here. Only a/b/c will be reported. Furthermore only ignored files /
+ * folders are returned that are NOT in the index.
+ *
+ * @return ignored paths
+ */
+ public Set<String> getIgnoredPaths() {
+ return ignoredPaths;
+ }
}