diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-12-07 16:49:51 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-12-07 16:49:51 -0800 |
commit | a02be9725c9f83f0a0280a9a1f00e8d484825885 (patch) | |
tree | f816874ef8ce86655e21912952e252e632184f92 /org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache | |
parent | 45731756a56361a51e839e26d3b0bed1c06ee37a (diff) | |
download | jgit-a02be9725c9f83f0a0280a9a1f00e8d484825885.tar.gz jgit-a02be9725c9f83f0a0280a9a1f00e8d484825885.zip |
Remove empty iterator from TreeWalk
Its confusing that a new TreeWalk() needs to have reset() invoked
on it before addTree(). This is a historical accident caused by
how TreeWalk was abused within ObjectWalk.
Drop the initial empty tree from the TreeWalk and thus remove a
number of pointless reset() operations from unit tests and some of
the internal JGit code.
Existing application code which is still calling reset() will simply
be incurring a few unnecessary field assignments, but they should
consider cleaning up their code in the future.
Change-Id: I434e94ffa43491019e7dff52ca420a4d2245f48b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache')
3 files changed, 0 insertions, 7 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java index a09f8e86c4..10dcd2af86 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java @@ -71,7 +71,6 @@ public class DirCacheBuilderIteratorTest extends RepositoryTestCase { final int expIdx = 2; final DirCacheBuilder b = dc.builder(); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(new DirCacheBuildIterator(b)); tw.setRecursive(true); tw.setFilter(PathFilterGroup.createFromStrings(Collections diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java index a7e2bc823b..00b94b38cf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -90,7 +90,6 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { { final Iterator<CGitIndexRecord> rItr = ls.values().iterator(); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.setRecursive(true); tw.addTree(new DirCacheIterator(dc)); while (rItr.hasNext()) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java index 24e3c34ddf..9390e29819 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java @@ -64,7 +64,6 @@ public class DirCacheIteratorTest extends RepositoryTestCase { assertEquals(0, dc.getEntryCount()); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(new DirCacheIterator(dc)); assertFalse(tw.next()); } @@ -112,7 +111,6 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final DirCacheIterator i = new DirCacheIterator(dc); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(i); int pathIdx = 0; while (tw.next()) { @@ -149,7 +147,6 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final DirCacheIterator i = new DirCacheIterator(dc); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(i); tw.setRecursive(false); int pathIdx = 0; @@ -189,7 +186,6 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final DirCacheIterator i = new DirCacheIterator(dc); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(i); tw.setRecursive(true); int pathIdx = 0; @@ -223,7 +219,6 @@ public class DirCacheIteratorTest extends RepositoryTestCase { b.finish(); final TreeWalk tw = new TreeWalk(db); - tw.reset(); tw.addTree(new DirCacheIterator(dc)); tw.setRecursive(true); int pathIdx = 0; |