diff --git a/plumbing/format/packfile/parser.go b/plumbing/format/packfile/parser.go index 71cbba983..e65394bae 100644 --- a/plumbing/format/packfile/parser.go +++ b/plumbing/format/packfile/parser.go @@ -282,6 +282,18 @@ func (p *Parser) resolveDeltas() error { if _, err := p.resolveObject(child, content); err != nil { return err } + + extRef, ok := p.oiByHash[child.SHA1] + if ok && extRef.ExternalRef { + // replace parent placeholder + p.oiByHash[child.SHA1] = child + + // adopt children + child.Children = extRef.Children + for _, c := range child.Children { + c.Parent = child + } + } } // Remove the delta from the cache.