Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java8
21 files changed, 12 insertions, 36 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
index a7c40acdb3..ed82c4b862 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
@@ -74,7 +74,6 @@ class DiffTree extends TextBuiltin {
@Override
protected void run() throws Exception {
final TreeWalk walk = new TreeWalk(db);
- walk.reset();
walk.setRecursive(recursive);
for (final AbstractTreeIterator i : trees)
walk.addTree(i);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
index 4b63edeb0d..6878d8ef48 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
@@ -62,7 +62,6 @@ class LsTree extends TextBuiltin {
@Override
protected void run() throws Exception {
final TreeWalk walk = new TreeWalk(db);
- walk.reset(); // drop the first empty tree, which we do not need here
walk.setRecursive(recursive);
walk.addTree(tree);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
index b42b915712..552d704508 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
@@ -59,7 +59,6 @@ import org.eclipse.jgit.diff.RawText;
import org.eclipse.jgit.diff.RawTextComparator;
import org.eclipse.jgit.errors.LargeObjectException;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
-import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.MutableObjectId;
@@ -190,7 +189,7 @@ class DiffAlgorithms extends TextBuiltin {
RevCommit p = c.getParent(0);
rw.parseHeaders(p);
- tw.reset(new AnyObjectId[] { p.getTree(), c.getTree() });
+ tw.reset(p.getTree(), c.getTree());
while (tw.next()) {
if (!isFile(tw, 0) || !isFile(tw, 1))
continue;
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;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
index f5b6bfb640..867e0603d9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
@@ -158,7 +158,6 @@ public class IgnoreNodeTest extends RepositoryTestCase {
private void beginWalk() throws CorruptObjectException {
walk = new TreeWalk(db);
- walk.reset();
walk.addTree(new FileTreeIterator(db));
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
index 5e04f32f82..bf86ef4585 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
@@ -77,7 +77,6 @@ public class RacyGitTests extends RepositoryTestCase {
FileTreeIteratorWithTimeControl fileIt = new FileTreeIteratorWithTimeControl(
db, modTimes);
NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(fileIt);
tw.setRecursive(true);
FileTreeIterator t;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
index b4732e2dc1..2bf81e16f1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
@@ -685,7 +685,6 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
public void assertWorkDir(HashMap<String, String> i)
throws CorruptObjectException, IOException {
TreeWalk walk = new TreeWalk(db);
- walk.reset();
walk.setRecursive(true);
walk.addTree(new FileTreeIterator(db));
String expectedValue;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
index 7e3dea6714..12ed780b8f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
@@ -82,7 +82,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
}
final TreeWalk tw = new TreeWalk(db);
- tw.reset();
tw.addTree(new DirCacheIterator(tree0));
tw.addTree(new DirCacheIterator(tree1));
@@ -113,7 +112,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
}
final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(new DirCacheIterator(tree0));
tw.addTree(new DirCacheIterator(tree1));
@@ -149,7 +147,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
}
final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(new DirCacheIterator(tree0));
tw.addTree(new DirCacheIterator(tree1));
@@ -185,7 +182,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
}
final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(new DirCacheIterator(tree0));
tw.addTree(new DirCacheIterator(tree1));
@@ -222,7 +218,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
}
final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(new DirCacheIterator(tree0));
tw.addTree(new DirCacheIterator(tree1));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java
index 8f813a806b..9152c60fed 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java
@@ -98,7 +98,6 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase {
}
final TreeWalk tw = new TreeWalk(db);
- tw.reset();
tw.setPostOrderTraversal(false);
tw.addTree(new DirCacheIterator(tree));
@@ -127,7 +126,6 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase {
}
final TreeWalk tw = new TreeWalk(db);
- tw.reset();
tw.setPostOrderTraversal(true);
tw.addTree(new DirCacheIterator(tree));
@@ -162,7 +160,6 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase {
}
final TreeWalk tw = new TreeWalk(db);
- tw.reset();
tw.setPostOrderTraversal(true);
tw.addTree(new DirCacheIterator(tree));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java
index e0957401c5..7c882719f7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java
@@ -105,7 +105,7 @@ public class TreeWalkBasicDiffTest extends RepositoryTestCase {
inserter.release();
final TreeWalk tw = new TreeWalk(db);
- tw.reset(new ObjectId[] { oldTree, newTree });
+ tw.reset(oldTree, newTree);
tw.setRecursive(true);
tw.setFilter(TreeFilter.ANY_DIFF);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
index 12326eade2..4ac82ecad4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
@@ -44,11 +44,13 @@
package org.eclipse.jgit.treewalk.filter;
import org.eclipse.jgit.lib.RepositoryTestCase;
+import org.eclipse.jgit.treewalk.EmptyTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk;
public class TreeFilterTest extends RepositoryTestCase {
public void testALL_IncludesAnything() throws Exception {
final TreeWalk tw = new TreeWalk(db);
+ tw.addTree(new EmptyTreeIterator());
assertTrue(TreeFilter.ALL.include(tw));
}
@@ -62,11 +64,13 @@ public class TreeFilterTest extends RepositoryTestCase {
public void testNotALL_IncludesNothing() throws Exception {
final TreeWalk tw = new TreeWalk(db);
+ tw.addTree(new EmptyTreeIterator());
assertFalse(TreeFilter.ALL.negate().include(tw));
}
public void testANY_DIFF_IncludesSingleTreeCase() throws Exception {
final TreeWalk tw = new TreeWalk(db);
+ tw.addTree(new EmptyTreeIterator());
assertTrue(TreeFilter.ANY_DIFF.include(tw));
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
index 12a5201f6e..fcc58d1791 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
@@ -138,7 +138,6 @@ public class AddCommand extends GitCommand<DirCache> {
DirCacheBuilder builder = dc.builder();
final TreeWalk tw = new TreeWalk(repo);
- tw.reset();
tw.addTree(new DirCacheBuildIterator(builder));
if (workingTreeIterator == null)
workingTreeIterator = new FileTreeIterator(repo);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
index fa0cb9c473..adcf0d8d60 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
@@ -431,7 +431,6 @@ public class DiffFormatter {
assertHaveRepository();
TreeWalk walk = new TreeWalk(reader);
- walk.reset();
walk.addTree(a);
walk.addTree(b);
walk.setRecursive(true);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
index 5665002dc7..ed09de3322 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
@@ -165,7 +165,6 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
public void addTree(final byte[] pathPrefix, final int stage,
final ObjectReader reader, final AnyObjectId tree) throws IOException {
final TreeWalk tw = new TreeWalk(reader);
- tw.reset();
tw.addTree(new CanonicalTreeParser(pathPrefix, reader, tree
.toObjectId()));
tw.setRecursive(true);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 11003ff4f0..01cecf40f8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -243,7 +243,6 @@ public class DirCacheCheckout {
walk = new NameConflictTreeWalk(repo);
builder = dc.builder();
- walk.reset();
addTree(walk, headCommitTree);
addTree(walk, mergeCommitTree);
walk.addTree(new DirCacheBuildIterator(builder));
@@ -285,7 +284,6 @@ public class DirCacheCheckout {
builder = dc.builder();
walk = new NameConflictTreeWalk(repo);
- walk.reset();
walk.addTree(mergeCommitTree);
walk.addTree(new DirCacheBuildIterator(builder));
walk.addTree(workingTree);
@@ -795,7 +793,6 @@ public class DirCacheCheckout {
private boolean isModified(String path) throws CorruptObjectException, IOException {
NameConflictTreeWalk tw = new NameConflictTreeWalk(repo);
- tw.reset();
tw.addTree(new DirCacheIterator(dc));
tw.addTree(new FileTreeIterator(repo.getWorkTree(), repo.getFS(),
WorkingTreeOptions.createDefaultInstance()));
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
index b9291f11dd..d0ef337035 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
@@ -169,7 +169,6 @@ public class IndexDiff {
boolean changesExist = false;
DirCache dirCache = repository.readDirCache();
TreeWalk treeWalk = new TreeWalk(repository);
- treeWalk.reset();
treeWalk.setRecursive(true);
// add the trees (tree, dirchache, workdir)
if (tree != null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 135597f659..4cf57e8400 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -59,10 +59,10 @@ import java.util.Map;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.diff.DiffAlgorithm;
-import org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm;
import org.eclipse.jgit.diff.RawText;
import org.eclipse.jgit.diff.RawTextComparator;
import org.eclipse.jgit.diff.Sequence;
+import org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuildIterator;
import org.eclipse.jgit.dircache.DirCacheBuilder;
@@ -183,7 +183,6 @@ public class ResolveMerger extends ThreeWayMerger {
DirCacheBuildIterator buildIt = new DirCacheBuildIterator(builder);
tw = new NameConflictTreeWalk(db);
- tw.reset();
tw.addTree(mergeBase());
tw.addTree(sourceTrees[0]);
tw.addTree(sourceTrees[1]);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
index b8bd4758c0..adb2278d89 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -112,7 +112,6 @@ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy {
@Override
protected boolean mergeImpl() throws IOException {
- tw.reset();
tw.addTree(mergeBase());
tw.addTree(sourceTrees[0]);
tw.addTree(sourceTrees[1]);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
index 992928bc43..93ca33e4c9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -84,6 +84,8 @@ import org.eclipse.jgit.util.RawParseUtils;
* permitted, even from concurrent threads.
*/
public class TreeWalk {
+ private static final AbstractTreeIterator[] NO_TREES = {};
+
/**
* Open a tree walk and filter to exactly one path.
* <p>
@@ -226,7 +228,7 @@ public class TreeWalk {
public TreeWalk(final ObjectReader or) {
reader = or;
filter = TreeFilter.ALL;
- trees = new AbstractTreeIterator[] { new EmptyTreeIterator() };
+ trees = NO_TREES;
}
/** @return the reader this walker is using to load objects. */
@@ -337,7 +339,7 @@ public class TreeWalk {
/** Reset this walker so new tree iterators can be added to it. */
public void reset() {
- trees = new AbstractTreeIterator[0];
+ trees = NO_TREES;
advance = false;
depth = 0;
}
@@ -400,7 +402,7 @@ public class TreeWalk {
* @throws IOException
* a loose object or pack file could not be read.
*/
- public void reset(final AnyObjectId[] ids) throws MissingObjectException,
+ public void reset(final AnyObjectId... ids) throws MissingObjectException,
IncorrectObjectTypeException, CorruptObjectException, IOException {
final int oldLen = trees.length;
final int newLen = ids.length;

Back to the top