diff options
author | Ivan Frade <ifrade@google.com> | 2021-12-16 13:08:33 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2022-10-18 11:19:21 -0700 |
commit | 96236fdcb5502f3071317b9cf2bf88019d7fb309 (patch) | |
tree | 3add379d1fe313942e07eb733473717a139ea72b /org.eclipse.jgit | |
parent | 60206ea95f1bff6a301ee65e532a27e085812a5d (diff) | |
download | jgit-96236fdcb5502f3071317b9cf2bf88019d7fb309.tar.gz jgit-96236fdcb5502f3071317b9cf2bf88019d7fb309.zip |
PackParser: populate full size of the PackedObjectInfos
We need the full size of the objects to populate the object-size index
of a pack. This size is not always the one encoded in the object header
in the pack (e.g. for deltas).
Populate the full size of PackedObjectInfos in the PackParser, which is
invoked when receiving a pack e.g. in a push.
Change-Id: I102c20901aefb5e85047e2e526c0d733f82ff74b
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index e43ea0261e..d9669044c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -658,7 +658,8 @@ public abstract class PackParser { } byte[] delta = inflateAndReturn(Source.DATABASE, info.size); - checkIfTooLarge(type, BinaryDelta.getResultSize(delta)); + long finalSz = BinaryDelta.getResultSize(delta); + checkIfTooLarge(type, finalSz); visit.data = BinaryDelta.apply(visit.parent.data, delta); delta = null; @@ -684,6 +685,7 @@ public abstract class PackParser { PackedObjectInfo oe; oe = newInfo(tempObjectId, visit.delta, visit.parent.id); + oe.setFullSize(finalSz); oe.setOffset(visit.delta.position); oe.setType(type); onInflatedObjectData(oe, type, visit.data); @@ -861,6 +863,7 @@ public abstract class PackParser { final int typeCode = ldr.getType(); final PackedObjectInfo oe = newInfo(baseId, null, null); oe.setType(typeCode); + oe.setFullSize(ldr.getSize()); if (onAppendBase(typeCode, visit.data, oe)) entries[entryCount++] = oe; visit.nextChild = firstChildOf(oe); @@ -1078,6 +1081,7 @@ public abstract class PackParser { obj.setOffset(pos); obj.setType(type); obj.setSize(sizeBeforeInflating); + obj.setFullSize(sz); onEndWholeObject(obj); if (data != null) onInflatedObjectData(obj, type, data); |