while (treeWalk.next()) {
AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
AbstractTreeIterator.class);
DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX,
DirCacheIterator.class);
WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
WorkingTreeIterator.class);
if (dirCacheIterator != null) {
final DirCacheEntry dirCacheEntry = dirCacheIterator
.getDirCacheEntry();
if (dirCacheEntry != null && dirCacheEntry.getStage() > 0) {
conflicts.add(treeWalk.getPathString());
continue;
}
}
if (treeIterator != null) {
if (dirCacheIterator != null) {
if (!treeIterator.idEqual(dirCacheIterator)
|| treeIterator.getEntryRawMode()
!= dirCacheIterator.getEntryRawMode()) {
// in repo, in index, content diff => changed
changed.add(treeWalk.getPathString());
}
} else {
// in repo, not in index => removed
removed.add(treeWalk.getPathString());
if (workingTreeIterator != null)
untracked.add(treeWalk.getPathString());
}
} else {
if (dirCacheIterator != null) {
// not in repo, in index => added
added.add(treeWalk.getPathString());
} else {
// not in repo, not in index => untracked
if (workingTreeIterator != null
&& !workingTreeIterator.isEntryIgnored()) {
untracked.add(treeWalk.getPathString());
}
}
}
if (dirCacheIterator != null) {
if (workingTreeIterator == null) {
// in index, not in workdir => missing
missing.add(treeWalk.getPathString());
} else {
if (workingTreeIterator.isModified(
dirCacheIterator.getDirCacheEntry(), true)) {
// in index, in workdir, content differs => modified
modified.add(treeWalk.getPathString());
}
}