Browse Source

Remove getRawSize, getRawType from ObjectLoader

These were only used by PackWriter to help it filter object
representations.  Their only user disappeared when we rewrote the
object selection code path to use the new representation type.

Change-Id: I9ed676bfe4f87fcf94aa21e53bda43115912e145
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 15 years ago
parent
commit
68518ca3aa
  1. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0004_PackReader.java
  2. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java
  3. 13
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
  4. 19
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaOfsPackedObjectLoader.java
  5. 5
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaPackedObjectLoader.java
  6. 11
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaRefPackedObjectLoader.java
  7. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
  8. 18
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackedObjectLoader.java
  9. 10
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObjectLoader.java
  10. 16
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WholePackedObjectLoader.java

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0004_PackReader.java

@ -71,7 +71,7 @@ public class T0004_PackReader extends SampleDataRepositoryTestCase {
assertNotNull(or);
assertEquals(Constants.OBJ_TREE, or.getType());
assertEquals(35, or.getSize());
assertEquals(7736, or.getObjectOffset());
assertEquals(7736, or.objectOffset);
pr.close();
}
@ -85,6 +85,6 @@ public class T0004_PackReader extends SampleDataRepositoryTestCase {
assertTrue(or instanceof PackedObjectLoader);
assertEquals(Constants.OBJ_BLOB, or.getType());
assertEquals(18009, or.getSize());
assertEquals(516, ((PackedObjectLoader) or).getObjectOffset());
assertEquals(516, ((PackedObjectLoader) or).objectOffset);
}
}

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java

@ -77,7 +77,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
final TestObject o = new TestObject();
o.id = ObjectId.fromString(parts[0]);
o.setType(parts[1]);
o.rawSize = Integer.parseInt(parts[2]);
// parts[2] is the inflate size
// parts[3] is the size-in-pack
o.offset = Long.parseLong(parts[4]);
toLoad.add(o);
@ -130,8 +130,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
assertNotNull(or);
assertTrue(or instanceof PackedObjectLoader);
assertEquals(o.type, or.getType());
assertEquals(o.rawSize, or.getRawSize());
assertEquals(o.offset, ((PackedObjectLoader) or).getObjectOffset());
assertEquals(o.offset, ((PackedObjectLoader) or).objectOffset);
}
}
@ -140,8 +139,6 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
int type;
int rawSize;
long offset;
void setType(final String typeStr) throws CorruptObjectException {

13
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java

@ -89,17 +89,4 @@ public abstract class ObjectLoader {
* @return the cached bytes of this object. Do not modify it.
*/
public abstract byte[] getCachedBytes();
/**
* @return raw object type from object header, as stored in storage (pack,
* loose file). This may be different from {@link #getType()} result
* for packs (see {@link Constants}).
*/
public abstract int getRawType();
/**
* @return raw size of object from object header (pack, loose file).
* Interpretation of this value depends on {@link #getRawType()}.
*/
public abstract long getRawSize();
}

19
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaOfsPackedObjectLoader.java

@ -48,11 +48,6 @@ package org.eclipse.jgit.storage.file;
import java.io.IOException;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
/** Reads a deltified object which uses an offset to find its base. */
class DeltaOfsPackedObjectLoader extends DeltaPackedObjectLoader {
private final long deltaBase;
@ -67,18 +62,4 @@ class DeltaOfsPackedObjectLoader extends DeltaPackedObjectLoader {
throws IOException {
return pack.resolveBase(curs, deltaBase);
}
@Override
public int getRawType() {
return Constants.OBJ_OFS_DELTA;
}
@Override
ObjectId getDeltaBase() throws IOException {
final ObjectId id = pack.findObjectForOffset(deltaBase);
if (id == null)
throw new CorruptObjectException(
JGitText.get().offsetWrittenDeltaBaseForObjectNotFoundInAPack);
return id;
}
}

5
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaPackedObjectLoader.java

@ -104,11 +104,6 @@ abstract class DeltaPackedObjectLoader extends PackedObjectLoader {
}
}
@Override
public long getRawSize() {
return deltaSize;
}
/**
* @param curs
* temporary thread storage during data access.

11
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/DeltaRefPackedObjectLoader.java

@ -49,7 +49,6 @@ package org.eclipse.jgit.storage.file;
import java.io.IOException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
/** Reads a deltified object which uses an {@link ObjectId} to find its base. */
@ -69,14 +68,4 @@ class DeltaRefPackedObjectLoader extends DeltaPackedObjectLoader {
throw new MissingObjectException(deltaBase, "delta base");
return or;
}
@Override
public int getRawType() {
return Constants.OBJ_REF_DELTA;
}
@Override
ObjectId getDeltaBase() throws IOException {
return deltaBase;
}
}

2
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java

@ -209,7 +209,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
* @throws IOException
* the pack file or the index could not be read.
*/
public PackedObjectLoader get(final WindowCursor curs, final AnyObjectId id)
PackedObjectLoader get(final WindowCursor curs, final AnyObjectId id)
throws IOException {
final long offset = idx().findOffset(id);
return 0 < offset && !isCorrupt(offset) ? reader(curs, offset) : null;

18
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackedObjectLoader.java

@ -48,7 +48,6 @@ package org.eclipse.jgit.storage.file;
import java.io.IOException;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
/**
@ -86,8 +85,6 @@ abstract class PackedObjectLoader extends ObjectLoader {
* <li>{@link #getType()}</li>
* <li>{@link #getSize()}</li>
* <li>{@link #getBytes()}, {@link #getCachedBytes}</li>
* <li>{@link #getRawSize()}</li>
* <li>{@link #getRawType()}</li>
* </ul>
*
* @param curs
@ -109,19 +106,4 @@ abstract class PackedObjectLoader extends ObjectLoader {
public final byte[] getCachedBytes() {
return cachedBytes;
}
/**
* @return offset of object header within pack file
*/
final long getObjectOffset() {
return objectOffset;
}
/**
* @return id of delta base object for this object representation. null if
* object is not stored as delta.
* @throws IOException
* when delta base cannot read.
*/
abstract ObjectId getDeltaBase() throws IOException;
}

10
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObjectLoader.java

@ -214,14 +214,4 @@ public class UnpackedObjectLoader extends ObjectLoader {
public byte[] getCachedBytes() {
return bytes;
}
@Override
public int getRawType() {
return objectType;
}
@Override
public long getRawSize() {
return objectSize;
}
}

16
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WholePackedObjectLoader.java

@ -52,7 +52,6 @@ import java.util.zip.DataFormatException;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
/** Reader for a non-delta (just deflated) object in a pack file. */
class WholePackedObjectLoader extends PackedObjectLoader {
@ -94,19 +93,4 @@ class WholePackedObjectLoader extends PackedObjectLoader {
throw coe;
}
}
@Override
public int getRawType() {
return objectType;
}
@Override
public long getRawSize() {
return objectSize;
}
@Override
ObjectId getDeltaBase() {
return null;
}
}

Loading…
Cancel
Save