diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-08-23 10:59:30 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-23 10:59:30 -0700 |
commit | 32466c33bae19aff03b95a02e0b7e72d4e2f11b8 (patch) | |
tree | ea652da99f86f53f8db72c40be8b027b75276ed3 /org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java | |
parent | 9d5b926ed164e8ee88d3b8b1e525d699adda01ba (diff) | |
download | jgit-32466c33bae19aff03b95a02e0b7e72d4e2f11b8.tar.gz jgit-32466c33bae19aff03b95a02e0b7e72d4e2f11b8.zip |
Delete deprecated ObjectWriter
ObjectWriter is a deprecated API that people shouldn't be using.
So get rid of it in favor of the ObjectInserter API.
Change-Id: I6218bcb26b6b9ffb64e3e470dba5dca2e0a62fd4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java | 22 |
1 files changed, 13 insertions, 9 deletions
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 fe2d0b248c..f2bb66fd30 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 @@ -110,21 +110,25 @@ public abstract class ReadTreeTest extends RepositoryTestCase { private Tree buildTree(HashMap<String, String> headEntries) throws IOException { Tree tree = new Tree(db); - ObjectWriter ow = new ObjectWriter(db); if (headEntries == null) return tree; FileTreeEntry fileEntry; Tree parent; - for (java.util.Map.Entry<String, String> e : headEntries.entrySet()) { - fileEntry = tree.addFile(e.getKey()); - fileEntry.setId(genSha1(e.getValue())); - parent = fileEntry.getParent(); - while (parent != null) { - parent.setId(ow.writeTree(parent)); - parent = parent.getParent(); + ObjectInserter oi = db.newObjectInserter(); + try { + for (java.util.Map.Entry<String, String> e : headEntries.entrySet()) { + fileEntry = tree.addFile(e.getKey()); + fileEntry.setId(genSha1(e.getValue())); + parent = fileEntry.getParent(); + while (parent != null) { + parent.setId(oi.insert(Constants.OBJ_TREE, parent.format())); + parent = parent.getParent(); + } } + oi.flush(); + } finally { + oi.release(); } - return tree; } |