aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)