From 3c36f7a11bfea2334133cbc2af786b8ffafa62fc Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Mon, 26 Nov 2018 12:20:19 +0100 Subject: [PATCH] Do not treat delta references as small objects that can be eagerly loaded. Signed-off-by: Filip Navara --- plumbing/format/packfile/packfile.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plumbing/format/packfile/packfile.go b/plumbing/format/packfile/packfile.go index e40302672..1e7ef2694 100644 --- a/plumbing/format/packfile/packfile.go +++ b/plumbing/format/packfile/packfile.go @@ -190,7 +190,14 @@ func (p *Packfile) objectAtOffset(offset int64) (plumbing.EncodedObject, error) // If we have no filesystem, we will return a MemoryObject instead // of an FSObject. - if p.fs == nil || h.Length <= smallObjectThreshold { + if p.fs == nil { + return p.getNextObject(h) + } + + // If the object is not a delta and it's small enough then read it + // completely into memory now since it is already read from disk + // into buffer anyway. + if h.Length <= smallObjectThreshold && h.Type != plumbing.OFSDeltaObject && h.Type != plumbing.REFDeltaObject { return p.getNextObject(h) }