summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-12-07 16:49:51 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-12-07 16:49:51 -0800
commita02be9725c9f83f0a0280a9a1f00e8d484825885 (patch)
treef816874ef8ce86655e21912952e252e632184f92 /org.eclipse.jgit.pgm/src
parent45731756a56361a51e839e26d3b0bed1c06ee37a (diff)
downloadjgit-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.pgm/src')
-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
3 files changed, 1 insertions, 4 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;