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>
This commit is contained in:
parent
86547022f0
commit
68518ca3aa
|
@ -71,7 +71,7 @@ public void test003_lookupCompressedObject() throws IOException {
|
|||
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 void test004_lookupDeltifiedObject() throws IOException {
|
|||
assertTrue(or instanceof PackedObjectLoader);
|
||||
assertEquals(Constants.OBJ_BLOB, or.getType());
|
||||
assertEquals(18009, or.getSize());
|
||||
assertEquals(516, ((PackedObjectLoader) or).getObjectOffset());
|
||||
assertEquals(516, ((PackedObjectLoader) or).objectOffset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public void setUp() throws Exception {
|
|||
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 @@ private void doCacheTests() throws IOException {
|
|||
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 @@ private class TestObject {
|
|||
|
||||
int type;
|
||||
|
||||
int rawSize;
|
||||
|
||||
long offset;
|
||||
|
||||
void setType(final String typeStr) throws CorruptObjectException {
|
||||
|
|
|
@ -89,17 +89,4 @@ public final byte[] getBytes() {
|
|||
* @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();
|
||||
}
|
||||
|
|
|
@ -48,11 +48,6 @@
|
|||
|
||||
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 @@ protected PackedObjectLoader getBaseLoader(final WindowCursor curs)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,11 +104,6 @@ void materialize(final WindowCursor curs) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRawSize() {
|
||||
return deltaSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param curs
|
||||
* temporary thread storage during data access.
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
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 @@ protected PackedObjectLoader getBaseLoader(final WindowCursor curs)
|
|||
throw new MissingObjectException(deltaBase, "delta base");
|
||||
return or;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawType() {
|
||||
return Constants.OBJ_REF_DELTA;
|
||||
}
|
||||
|
||||
@Override
|
||||
ObjectId getDeltaBase() throws IOException {
|
||||
return deltaBase;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public boolean hasObject(final AnyObjectId id) throws IOException {
|
|||
* @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;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
|
||||
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 @@ public final long getSize() {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -214,14 +214,4 @@ public long getSize() {
|
|||
public byte[] getCachedBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRawSize() {
|
||||
return objectSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
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 @@ void materialize(final WindowCursor curs) throws IOException {
|
|||
throw coe;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRawSize() {
|
||||
return objectSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
ObjectId getDeltaBase() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue