Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to resolve deltas when PlainClone or Fetching from a new AWS CodeCommit repository #391

Closed
ga-paul-t opened this issue Oct 11, 2021 · 4 comments

Comments

@ga-paul-t
Copy link
Contributor

ga-paul-t commented Oct 11, 2021

When attempting to clone a newly created repository in AWS CodeCommit, that for example only contains a single commit, the following error is encountered:

reference delta not found

The following code is used to perform the clone:

repo, err := git.PlainClone(dir, false, &git.CloneOptions{
    URL:           url,
    ReferenceName: plumbing.NewBranchReferenceName("main"),
    Tags:          git.AllTags,
    SingleBranch:  true,
    Depth:         1,
})

I never encounter this issue when cloning from another source control system like Github

@ga-paul-t
Copy link
Contributor Author

ga-paul-t commented Oct 11, 2021

I have tried it with a few more CodeCommit repositories, and I can confirm that it doesn't always fail

@ga-paul-t
Copy link
Contributor Author

Looking in the parser.go file, I can see where the External Reference is identified that ultimately results in the error being returned. However, the comment denotes that an external reference in a think pack file must be resolved. Looking through the source file I see no reference to that resolution ever taking place.

case plumbing.REFDeltaObject:
	delta = true
	parent, ok := p.oiByHash[oh.Reference]
	if !ok {
		// can't find referenced object in this pack file
		// this must be a "thin" pack.
		parent = &objectInfo{ //Placeholder parent
			SHA1:        oh.Reference,
			ExternalRef: true, // mark as an external reference that must be resolved
			Type:        plumbing.AnyObject,
			DiskType:    plumbing.AnyObject,
		}
		p.oiByHash[oh.Reference] = parent
	}
	ota = newDeltaObject(oh.Offset, oh.Length, t, parent)
	parent.Children = append(parent.Children, ota)

@ga-paul-t
Copy link
Contributor Author

ga-paul-t commented Oct 11, 2021

Looking through pull requests that are still open I have found a resolution that addresses this issue. I have tried it out with many different CodeCommit repositories and Github repositories, and it behaves as intended. A clone is successful with no reference delta error being returned.

#111

Any reason why this PR was never merged?

@pjbgf
Copy link
Member

pjbgf commented Mar 9, 2024

Closing as this was closed as part of #392 / #484.

@pjbgf pjbgf closed this as completed Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants