aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-05-15 17:37:14 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-05-15 17:37:18 -0700
commitcb5bc195406aaead0de6fa563b4b8aaacb8d20b8 (patch)
tree1530e315e73443da4d932ae997812f12fd1e1b71 /org.eclipse.jgit.test/tst/org/eclipse
parent9c4d42e94dbf199a9cef46a4b9286552c8633f4f (diff)
downloadjgit-cb5bc195406aaead0de6fa563b4b8aaacb8d20b8.tar.gz
jgit-cb5bc195406aaead0de6fa563b4b8aaacb8d20b8.zip
Reduce size of PackedObjectLoader by dropping long to int
Rather than keep track of both the position of the object, and the position of its data, just keep track of the number of bytes used by the object's header in the pack. This shaves 4 bytes out of the size of the PackedObjectLoader instances. We also can defer the addition instruction to the materialize() operation, avoiding it entirely if the caller never actually uses the loader. This may be relevant for PackWriter invocations, where only 1 loader gets chosen for a given object, even though the object may appear on disk in more than one pack file. Error reporting is now simplified, as we can rely on the object offset rather than its data offset. This is the value displayed by pack debugging tools like `git verify-pack -v`, so its better to use that in our own errors. Because nobody needs getDataOffset() now, we can drop that from the public API. Change-Id: Ic639c0d5a722315f4f5c8ffda6e26643d90e5f42 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java
index b78b7b8554..336bba22ce 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java
@@ -67,7 +67,7 @@ public class T0004_PackReader extends SampleDataRepositoryTestCase {
assertNotNull(or);
assertEquals(Constants.OBJ_TREE, or.getType());
assertEquals(35, or.getSize());
- assertEquals(7738, or.getDataOffset());
+ assertEquals(7736, or.getObjectOffset());
pr.close();
}
@@ -81,6 +81,6 @@ public class T0004_PackReader extends SampleDataRepositoryTestCase {
assertTrue(or instanceof PackedObjectLoader);
assertEquals(Constants.OBJ_BLOB, or.getType());
assertEquals(18009, or.getSize());
- assertEquals(537, ((PackedObjectLoader) or).getDataOffset());
+ assertEquals(516, ((PackedObjectLoader) or).getObjectOffset());
}
}