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

PlainCloneContext fails with "reference delta not found" error when using aws codecommit repository #336

Closed
bassofed opened this issue Jun 16, 2021 · 3 comments

Comments

@bassofed
Copy link

I'd like to have news on this old bug.

This is my code:

func main() {
	log.Println("Script git started")

	repos := [6]string{"my_repo_1", "my_repo_2", "my_repo_3", "my_repo_4", "my_repo_5", "my_repo_6"}

	for i := 0; i < len(repos); i++ {
		reponame := repos[i]

		log.Println("BEGIN: " + reponame)

		repourl := "https://git-codecommit.us-west-2.amazonaws.com/v1/repos/" + reponame

		gitOptions := git.CloneOptions{
			URL:             repourl,
			Depth:           1,
			RemoteName:      "origin",
			ReferenceName:   plumbing.ReferenceName("refs/heads/master"),
			SingleBranch:    true,
			NoCheckout:      false,
			Progress:        nil,
			Tags:            git.NoTags,
			InsecureSkipTLS: true,
			Auth: &githttp.BasicAuth{
				Username: "my_aws_user",
				Password: "my_aws_password",
			},
		}

		_, err := git.PlainCloneContext(context.TODO(), reponame, false, &gitOptions)

		if err != nil {
			log.Println("error:")
			log.Println(err)
		} else {
			log.Println("success")
		}

		log.Println("END: " + reponame)
	}

}

with the following output:

2021/06/16 15:18:15 Script git started
2021/06/16 15:18:15 BEGIN: my_repo_1
2021/06/16 15:18:19 success
2021/06/16 15:18:19 END: my_repo_1
2021/06/16 15:18:19 BEGIN: my_repo_2
2021/06/16 15:44:34 error:
2021/06/16 15:44:34 reference delta not found
2021/06/16 15:44:34 END: my_repo_2
2021/06/16 15:44:34 BEGIN: my_repo_3
2021/06/16 15:45:12 success
2021/06/16 15:45:12 END: my_repo_3
2021/06/16 15:45:12 BEGIN: my_repo_4
2021/06/16 15:45:18 error:
2021/06/16 15:45:18 reference delta not found
2021/06/16 15:45:18 END: my_repo_4
2021/06/16 15:45:18 BEGIN: my_repo_5
2021/06/16 15:48:19 error:
2021/06/16 15:48:19 reference delta not found
2021/06/16 15:48:19 END: my_repo_5
2021/06/16 15:48:19 BEGIN: my_repo_6
2021/06/16 15:52:43 error:
2021/06/16 15:52:43 reference delta not found
2021/06/16 15:52:43 END: my_repo_6

only 2 out of 6 clone works
I tried several times and it always fails on the same repos

@bassofed
Copy link
Author

It seems that the zlib compression fails to read the headers of some reference in the repository.
It seems more a AWS compression problem but I can't understand why plain git works

@bassofed
Copy link
Author

This pull request fixes this problem for me

@AriehSchneier
Copy link
Contributor

@pjbgf please close as fixed in #392 (and also can close #111)

@pjbgf pjbgf closed this as completed May 8, 2023
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

3 participants