use of org.eclipse.jgit.treewalk.EmptyTreeIterator in project egit by eclipse.
the class RemoveCommand method isTracked.
private boolean isTracked(File file, Repository repo) throws IOException {
ObjectId objectId = repo.resolve(Constants.HEAD);
RevTree tree;
try (RevWalk rw = new RevWalk(repo);
TreeWalk treeWalk = new TreeWalk(repo)) {
if (objectId != null)
tree = rw.parseTree(objectId);
else
tree = null;
treeWalk.setRecursive(true);
if (tree != null)
treeWalk.addTree(tree);
else
treeWalk.addTree(new EmptyTreeIterator());
treeWalk.addTree(new DirCacheIterator(repo.readDirCache()));
treeWalk.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(Repository.stripWorkDir(repo.getWorkTree(), file))));
return treeWalk.next();
}
}
Aggregations