]> source.dussan.org Git - jgit.git/commitdiff
Remove Repository.toFile(ObjectId) 58/958/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 24 Jun 2010 00:44:13 +0000 (17:44 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 26 Jun 2010 00:58:39 +0000 (17:58 -0700)
Not every type of Repository will be able to map an ObjectId into
a local file system path that stores that object's file contents.
Heck, its not even true for the FileRepository, as an object can
be stored in a pack file and not in its loose format.

Remove this from our public API, it was a mistake to publish it.

Change-Id: I20d1b8c39104023936e6d46a5b0d7ef39ff118e8
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/FileRepository.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

index 4e87fd624c12c15da15ecf202b134bb6a78b66c4..c770d605d0c89d1d6abc0683ce69ff44d3563602 100644 (file)
@@ -365,8 +365,10 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
                assertEquals(cmtid, c.getCommitId());
 
                // Verify the commit we just wrote is in the correct format.
-               final XInputStream xis = new XInputStream(new FileInputStream(db
-                               .toFile(cmtid)));
+               ObjectDatabase odb = db.getObjectDatabase();
+               assertTrue("is ObjectDirectory", odb instanceof ObjectDirectory);
+               final XInputStream xis = new XInputStream(new FileInputStream(
+                               ((ObjectDirectory) odb).fileFor(cmtid)));
                try {
                        assertEquals(0x78, xis.readUInt8());
                        assertEquals(0x9c, xis.readUInt8());
index 32f516f7d925c4933d2abeffb9c2ab29b79ff4e5..86ae5fadaebcf8de0bf92ee91efd28119e4c9d32 100644 (file)
@@ -380,20 +380,6 @@ public class FileRepository extends Repository {
                return repoConfig;
        }
 
-       /**
-        * Construct a filename where the loose object having a specified SHA-1
-        * should be stored. If the object is stored in a shared repository the path
-        * to the alternative repo will be returned. If the object is not yet store
-        * a usable path in this repo will be returned. It is assumed that callers
-        * will look for objects in a pack first.
-        *
-        * @param objectId
-        * @return suggested file name
-        */
-       public File toFile(final AnyObjectId objectId) {
-               return objectDatabase.fileFor(objectId);
-       }
-
        /**
         * Objects known to exist but not expressed by {@link #getAllRefs()}.
         * <p>
index 400cae43d40ff54c0e046b7d5da8b8e2c000cd94..09411a453176a001b9efd6006ccef9cad8f3f255 100644 (file)
@@ -173,18 +173,6 @@ public abstract class Repository {
                return fs;
        }
 
-       /**
-        * Construct a filename where the loose object having a specified SHA-1
-        * should be stored. If the object is stored in a shared repository the path
-        * to the alternative repo will be returned. If the object is not yet store
-        * a usable path in this repo will be returned. It is assumed that callers
-        * will look for objects in a pack first.
-        *
-        * @param objectId
-        * @return suggested file name
-        */
-       public abstract File toFile(AnyObjectId objectId);
-
        /**
         * @param objectId
         * @return true if the specified object is stored in this repo or any of the