[JGIT PATCH 02/10] Change empty tree test case to use a temporary repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <spearce@xxxxxxxxxxx>
---
 .../tst/org/spearce/jgit/lib/T0003_Basic.java      |   11 +++++------
 1 files 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 6a296be..b9e8d1d 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 void test002_WriteEmptyTree() throws IOException {
 		// 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());
 	}
-- 
1.6.3.rc1.188.ga02b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]