From df63b26ad972a00c4681bb1eb0a325bb4eb4229d Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 20 Apr 2009 18:21:04 -0700 Subject: [PATCH] Change empty tree test case to use a temporary repository This test case looks for a loose object of the empty tree, but our stock test repository contains the empty tree in a pack file. So the only way we can ensure it will be written is if we write to an empty repository. Signed-off-by: Shawn O. Pearce Signed-off-by: Robin Rosenberg --- .../tst/org/spearce/jgit/lib/T0003_Basic.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java index 6a296be0..b9e8d1d0 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java @@ -75,14 +75,13 @@ public class T0003_Basic extends RepositoryTestCase { // open when we create it we won't write the object file out as a loose // object (as it already exists in the pack). // - db.closePacks(); - - final Tree t = new Tree(db); - t.accept(new WriteTree(trash, db), TreeEntry.MODIFIED_ONLY); + final Repository newdb = createNewEmptyRepo(); + final Tree t = new Tree(newdb); + t.accept(new WriteTree(trash, newdb), TreeEntry.MODIFIED_ONLY); assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() .name()); - final File o = new File(new File(new File(trash_git, "objects"), "4b"), - "825dc642cb6eb9a060e54bf8d69288fbee4904"); + final File o = new File(new File(new File(newdb.getDirectory(), + "objects"), "4b"), "825dc642cb6eb9a060e54bf8d69288fbee4904"); assertTrue("Exists " + o, o.isFile()); assertTrue("Read-only " + o, !o.canWrite()); } -- 2.11.4.GIT