From b7346f9ea8ba2a4cc11dd43a3ed9ad09f02b3cef Mon Sep 17 00:00:00 2001 From: Kevin Burge Date: Sun, 10 Apr 2022 06:14:15 -0500 Subject: [PATCH] rebase-squashed branch fix-reference-delta-not-found --- plumbing/format/packfile/parser.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plumbing/format/packfile/parser.go b/plumbing/format/packfile/parser.go index d8c0f753d..1850db5a6 100644 --- a/plumbing/format/packfile/parser.go +++ b/plumbing/format/packfile/parser.go @@ -286,6 +286,18 @@ func (p *Parser) resolveDeltas() error { if err := p.resolveObject(ioutil.Discard, 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.