aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaul.t <paul.t@gembaadvantage.com>2021-10-11 13:07:34 +0100
committerpaul.t <paul.t@gembaadvantage.com>2021-10-11 13:07:34 +0100
commit51514482c696e7d3aadd551cd1308cedc7055ce0 (patch)
treee313d27377c2e7f9db96f1f8d7487965626055cc
parent4ec1753b4e9324d455d3b55060020ce324e6ced2 (diff)
downloadgo-git-51514482c696e7d3aadd551cd1308cedc7055ce0.tar.gz
resolve external reference delta
-rw-r--r--plumbing/format/packfile/parser.go11
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)