Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 3c36f7a

Browse files
committed
Do not treat delta references as small objects that can be eagerly loaded.
Signed-off-by: Filip Navara <[email protected]>
1 parent 4cb21e2 commit 3c36f7a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plumbing/format/packfile/packfile.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,14 @@ func (p *Packfile) objectAtOffset(offset int64) (plumbing.EncodedObject, error)
190190

191191
// If we have no filesystem, we will return a MemoryObject instead
192192
// of an FSObject.
193-
if p.fs == nil || h.Length <= smallObjectThreshold {
193+
if p.fs == nil {
194+
return p.getNextObject(h)
195+
}
196+
197+
// If the object is not a delta and it's small enough then read it
198+
// completely into memory now since it is already read from disk
199+
// into buffer anyway.
200+
if h.Length <= smallObjectThreshold && h.Type != plumbing.OFSDeltaObject && h.Type != plumbing.REFDeltaObject {
194201
return p.getNextObject(h)
195202
}
196203

0 commit comments

Comments
 (0)