diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-06-24 11:32:58 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-06-25 18:03:41 -0700 |
commit | 767fd314ada5649f77c18e9f4e9b744261301520 (patch) | |
tree | 1ef4751e17c49b690d4485b14b3984551f6c79dd /org.eclipse.jgit.test/tst/org/eclipse/jgit/lib | |
parent | ffe0614d4db653cbcd48c19e9f599fd87cdcfaba (diff) | |
download | jgit-767fd314ada5649f77c18e9f4e9b744261301520.tar.gz jgit-767fd314ada5649f77c18e9f4e9b744261301520.zip |
Use getObjectsDatabase().getDirectory() to find objects
Only the ObjectDirectory type of database knows where to find the
objects directory on the local filesystem, so defer to it whenever
we need to know where the objects reside. Since this is the type
returned by FileRepository's getObjectDatabase() method, we mostly
don't have to do much other than use a slightly longer invocation.
Change-Id: Ie5f58132a6411b56c3acad73646ad169d78a0654
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib')
4 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java index 69430ed334..e3a62faf23 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java @@ -245,7 +245,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { } private File fullPackFileName(final ObjectId name, final String suffix) { - final File packdir = new File(db.getObjectsDirectory(), "pack"); + final File packdir = new File(db.getObjectDatabase().getDirectory(), "pack"); return new File(packdir, "pack-" + name.name() + suffix); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java index 76b663a29b..c291968b74 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java @@ -238,7 +238,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { * @throws IOException */ public void testWritePack2DeltasCRC32Copy() throws IOException { - final File packDir = new File(db.getObjectsDirectory(), "pack"); + final File packDir = new File(db.getObjectDatabase().getDirectory(), "pack"); final File crc32Pack = new File(packDir, "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack"); final File crc32Idx = new File(packDir, diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java index 10c005679b..7bc9bb22e7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java @@ -65,7 +65,7 @@ public abstract class SampleDataRepositoryTestCase extends RepositoryTestCase { "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa", "pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12" }; - final File packDir = new File(db.getObjectsDirectory(), "pack"); + final File packDir = new File(db.getObjectDatabase().getDirectory(), "pack"); for (String n : packs) { copyFile(JGitTestUtil.getTestResourceFile(n + ".pack"), new File(packDir, n + ".pack")); copyFile(JGitTestUtil.getTestResourceFile(n + ".idx"), new File(packDir, n + ".idx")); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java index aab57aa594..484692ee21 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java @@ -106,7 +106,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(repo1Parent, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); - assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); + assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase().getDirectory()); } /** @@ -127,7 +127,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); - assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); + assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase().getDirectory()); } /** @@ -147,7 +147,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(repo1Parent, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); - assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); + assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase().getDirectory()); } /** @@ -172,7 +172,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); - assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); + assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase().getDirectory()); } /** @@ -197,7 +197,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); - assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); + assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase().getDirectory()); } /** @@ -211,7 +211,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { File repo1Parent = new File(trash.getParentFile(), "r1"); File indexFile = new File(trash, "idx"); File objDir = new File(trash, "../obj"); - File altObjDir = db.getObjectsDirectory(); + File altObjDir = db.getObjectDatabase().getDirectory(); Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT)); repo1initial.create(); repo1initial.close(); @@ -225,7 +225,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(theDir.getParentFile(), r.getWorkTree()); assertEqualsPath(indexFile, r.getIndexFile()); - assertEqualsPath(objDir, r.getObjectsDirectory()); + assertEqualsPath(objDir, r.getObjectDatabase().getDirectory()); assertNotNull(r.mapCommit("6db9c2ebf75590eef973081736730a9ea169a0c4")); // Must close or the default repo pack files created by this test gets // locked via the alternate object directories on Windows. @@ -327,7 +327,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { public void test007_Open() throws IOException { final FileRepository db2 = new FileRepository(db.getDirectory()); assertEquals(db.getDirectory(), db2.getDirectory()); - assertEquals(db.getObjectsDirectory(), db2.getObjectsDirectory()); + assertEquals(db.getObjectDatabase().getDirectory(), db2.getObjectDatabase().getDirectory()); assertNotSame(db.getConfig(), db2.getConfig()); } |