|
|
@ -48,6 +48,7 @@ import java.util.LinkedList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.dircache.DirCacheEntry; |
|
|
|
import org.eclipse.jgit.dircache.DirCacheIterator; |
|
|
|
import org.eclipse.jgit.dircache.DirCacheIterator; |
|
|
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException; |
|
|
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException; |
|
|
|
import org.eclipse.jgit.errors.MissingObjectException; |
|
|
|
import org.eclipse.jgit.errors.MissingObjectException; |
|
|
@ -133,6 +134,14 @@ public class IndexDiffFilter extends TreeFilter { |
|
|
|
final int wm = tw.getRawMode(workingTree); |
|
|
|
final int wm = tw.getRawMode(workingTree); |
|
|
|
String path = tw.getPathString(); |
|
|
|
String path = tw.getPathString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DirCacheIterator di = tw.getTree(dirCache, DirCacheIterator.class); |
|
|
|
|
|
|
|
if (di != null) { |
|
|
|
|
|
|
|
DirCacheEntry dce = di.getDirCacheEntry(); |
|
|
|
|
|
|
|
if (dce != null) |
|
|
|
|
|
|
|
if (dce.isAssumeValid()) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!tw.isPostOrderTraversal()) { |
|
|
|
if (!tw.isPostOrderTraversal()) { |
|
|
|
// detect untracked Folders
|
|
|
|
// detect untracked Folders
|
|
|
|
// Whenever we enter a folder in the workingtree assume it will
|
|
|
|
// Whenever we enter a folder in the workingtree assume it will
|
|
|
@ -153,7 +162,7 @@ public class IndexDiffFilter extends TreeFilter { |
|
|
|
// it.
|
|
|
|
// it.
|
|
|
|
for (int i = 0; i < cnt; i++) { |
|
|
|
for (int i = 0; i < cnt; i++) { |
|
|
|
int rmode = tw.getRawMode(i); |
|
|
|
int rmode = tw.getRawMode(i); |
|
|
|
if (i != workingTree && rmode != 0 |
|
|
|
if (i != workingTree && rmode != FileMode.TYPE_MISSING |
|
|
|
&& FileMode.TREE.equals(rmode)) { |
|
|
|
&& FileMode.TREE.equals(rmode)) { |
|
|
|
untrackedParentFolders.clear(); |
|
|
|
untrackedParentFolders.clear(); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -171,14 +180,14 @@ public class IndexDiffFilter extends TreeFilter { |
|
|
|
// other tree.
|
|
|
|
// other tree.
|
|
|
|
final int dm = tw.getRawMode(dirCache); |
|
|
|
final int dm = tw.getRawMode(dirCache); |
|
|
|
WorkingTreeIterator wi = workingTree(tw); |
|
|
|
WorkingTreeIterator wi = workingTree(tw); |
|
|
|
if (dm == 0) { |
|
|
|
if (dm == FileMode.TYPE_MISSING) { |
|
|
|
if (honorIgnores && wi.isEntryIgnored()) { |
|
|
|
if (honorIgnores && wi.isEntryIgnored()) { |
|
|
|
ignoredPaths.add(wi.getEntryPathString()); |
|
|
|
ignoredPaths.add(wi.getEntryPathString()); |
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
for (; i < cnt; i++) { |
|
|
|
for (; i < cnt; i++) { |
|
|
|
if (i == dirCache || i == workingTree) |
|
|
|
if (i == dirCache || i == workingTree) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
if (tw.getRawMode(i) != 0) |
|
|
|
if (tw.getRawMode(i) != FileMode.TYPE_MISSING) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -209,7 +218,6 @@ public class IndexDiffFilter extends TreeFilter { |
|
|
|
// Only one chance left to detect a diff: between index and working
|
|
|
|
// Only one chance left to detect a diff: between index and working
|
|
|
|
// tree. Make use of the WorkingTreeIterator#isModified() method to
|
|
|
|
// tree. Make use of the WorkingTreeIterator#isModified() method to
|
|
|
|
// avoid computing SHA1 on filesystem content if not really needed.
|
|
|
|
// avoid computing SHA1 on filesystem content if not really needed.
|
|
|
|
DirCacheIterator di = tw.getTree(dirCache, DirCacheIterator.class); |
|
|
|
|
|
|
|
return wi.isModified(di.getDirCacheEntry(), true); |
|
|
|
return wi.isModified(di.getDirCacheEntry(), true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|