* Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2010, Jens Baumgart <jens.baumgart@sap.com>
* Copyright (C) 2013, Robin Stocker <robin@nibor.org>
+ * Copyright (C) 2014, Axel Richard <axel.richard@obeo.fr>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
private IgnoreSubmoduleMode ignoreSubmoduleMode = null;
+ private Map<FileMode, Set<String>> fileModes = new HashMap<FileMode, Set<String>>();
+
/**
* Construct an IndexDiff
*
indexDiffFilter = new IndexDiffFilter(INDEX, WORKDIR);
filters.add(indexDiffFilter);
treeWalk.setFilter(AndTreeFilter.create(filters));
+ fileModes.clear();
while (treeWalk.next()) {
AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
AbstractTreeIterator.class);
}
}
}
+
+ for (int i = 0; i < treeWalk.getTreeCount(); i++) {
+ Set<String> values = fileModes.get(treeWalk.getFileMode(i));
+ String path = treeWalk.getPathString();
+ if (path != null) {
+ if (values == null)
+ values = new HashSet<String>();
+ values.add(path);
+ fileModes.put(treeWalk.getFileMode(i), values);
+ }
+ }
}
if (ignoreSubmoduleMode != IgnoreSubmoduleMode.ALL) {
}
}
}
+
}
// consume the remaining work
final DirCacheEntry entry = dirCache.getEntry(path);
return entry != null ? entry.getFileMode() : FileMode.MISSING;
}
+
+ /**
+ * Get the list of paths that IndexDiff has detected to differ and have the
+ * given file mode
+ *
+ * @param mode
+ * @return the list of paths that IndexDiff has detected to differ and have
+ * the given file mode
+ * @since 3.6
+ */
+ public Set<String> getPathsWithIndexMode(final FileMode mode) {
+ Set<String> paths = fileModes.get(mode);
+ if (paths == null)
+ paths = new HashSet<String>();
+ return paths;
+ }
}