521522523524525526527528529530531
while ((paths.size() > 0) && (commit = commitWalk.next()) != null) { TreeWalk diffWalk = new TreeWalk(reader); int parentCount = commit.getParentCount(); switch (parentCount) { case 0: diffWalk.addTree(new EmptyTreeIterator()); break; case 1: diffWalk.addTree(getTree(commitWalk, commit.getParent(0))); break; default:
9596979899100101102103104105
final RevWalk rWalk, final RevCommit commit) throws IOException { final TreeWalk walk = new TreeWalk(reader); final int parentCount = commit.getParentCount(); switch (parentCount) { case 0: walk.addTree(new EmptyTreeIterator()); break; case 1: walk.addTree(getTree(rWalk, commit.getParent(0))); break; default:
5455565758596061
public class TreeFilterTest extends RepositoryTestCase { @Test public void testALL_IncludesAnything() throws Exception { final TreeWalk tw = new TreeWalk(db); tw.addTree(new EmptyTreeIterator()); assertTrue(TreeFilter.ALL.include(tw)); }
7172737475767778
} @Test public void testNotALL_IncludesNothing() throws Exception { final TreeWalk tw = new TreeWalk(db); tw.addTree(new EmptyTreeIterator()); assertFalse(TreeFilter.ALL.negate().include(tw)); }
7879808182838485
} @Test public void testANY_DIFF_IncludesSingleTreeCase() throws Exception { final TreeWalk tw = new TreeWalk(db); tw.addTree(new EmptyTreeIterator()); assertTrue(TreeFilter.ANY_DIFF.include(tw)); }
132133134135136137138139140141142
RevCommit baseCommit = (baseCommitId != null) ? walk .parseCommit(baseCommitId) : getBaseCommit(sourceCommits[0], sourceCommits[1]); if (baseCommit == null) { baseCommitId = null; return new EmptyTreeIterator(); } else { baseCommitId = baseCommit.toObjectId(); return openTree(baseCommit.getTree()); } }
404405406407408409410411412413414
treeWalk.setRecursive(true); // add the trees (tree, dirchache, workdir) if (tree != null) treeWalk.addTree(tree); else treeWalk.addTree(new EmptyTreeIterator()); treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(initialWorkingTreeIterator); Collection<TreeFilter> filters = new ArrayList<TreeFilter>(4); if (monitor != null) {
260261262263264265266267268
} } private void addTree(TreeWalk tw, ObjectId id) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (id == null) tw.addTree(new EmptyTreeIterator()); else tw.addTree(id); }
135136137138139140141
@Override public EmptyTreeIterator createEmptyTreeIterator() { final byte[] n = new byte[Math.max(pathLen + 1, DEFAULT_PATH_SIZE)]; System.arraycopy(path, 0, n, 0, pathLen); n[pathLen] = '/'; return new EmptyTreeIterator(this, n, pathLen + 1); }
312313314315316317318319320321322
final TreeWalk tw = new TreeWalk(repo); tw.addTree(new DirCacheBuildIterator(builder)); if (commitTree != null) tw.addTree(commitTree); else tw.addTree(new EmptyTreeIterator()); tw.setFilter(PathFilterGroup.createFromStrings(filepaths)); tw.setRecursive(true); while (tw.next()) { final CanonicalTreeParser tree = tw.getTree(1,