Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
fix "reference delta not found" when cloning from aws codecommit
Browse files Browse the repository at this point in the history
The existing code does not handle the case where a ref delta refers to another
deltified object.  Once the "parent" was undeltified, not attempt was made to
resolve references to that object's SHA1.

This change simply checks to see if there is an ExternalRef to the object just
resolved, and if so, replaces it and adopts its children.

I'm not an expert in the bowels of git, but this fixed my inability to clone
from codecommit.

Signed-off-by: Kevin Burge <[email protected]>
  • Loading branch information
Kevin Burge authored and kcburge committed Apr 21, 2019
1 parent 948b0c9 commit 75032bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plumbing/format/packfile/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 75032bb

Please sign in to comment.