diff options
author | paul.t <paul.t@gembaadvantage.com> | 2021-10-11 13:07:34 +0100 |
---|---|---|
committer | paul.t <paul.t@gembaadvantage.com> | 2021-10-11 13:07:34 +0100 |
commit | 51514482c696e7d3aadd551cd1308cedc7055ce0 (patch) | |
tree | e313d27377c2e7f9db96f1f8d7487965626055cc /plumbing | |
parent | 4ec1753b4e9324d455d3b55060020ce324e6ced2 (diff) | |
download | go-git-51514482c696e7d3aadd551cd1308cedc7055ce0.tar.gz |
resolve external reference delta
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/packfile/parser.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plumbing/format/packfile/parser.go b/plumbing/format/packfile/parser.go index 4b5a570..4c28a4a 100644 --- a/plumbing/format/packfile/parser.go +++ b/plumbing/format/packfile/parser.go @@ -287,6 +287,7 @@ func (p *Parser) resolveDeltas() error { if err := p.resolveObject(stdioutil.Discard, child, content); err != nil { return err } + p.resolveExternalRef(child) } // Remove the delta from the cache. @@ -299,6 +300,16 @@ func (p *Parser) resolveDeltas() error { return nil } +func (p *Parser) resolveExternalRef(o *objectInfo) { + if ref, ok := p.oiByHash[o.SHA1]; ok && ref.ExternalRef { + p.oiByHash[o.SHA1] = o + o.Children = ref.Children + for _, c := range o.Children { + c.Parent = o + } + } +} + func (p *Parser) get(o *objectInfo, buf *bytes.Buffer) (err error) { if !o.ExternalRef { // skip cache check for placeholder parents b, ok := p.cache.Get(o.Offset) |