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

Fetch: object not found #129

Closed
Asgoret opened this issue Jul 6, 2020 · 2 comments
Closed

Fetch: object not found #129

Asgoret opened this issue Jul 6, 2020 · 2 comments

Comments

@Asgoret
Copy link

Asgoret commented Jul 6, 2020

Hi to all.
I have a similar issue -> src-d/go-git#802
I tried to play with depth in clone and fetch, but it didn't help.
Code:

	repo, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
		Auth: &http.BasicAuth{
			Username: "<username>",
			Password: "<password>,
		},
		ReferenceName: plumbing.ReferenceName(fmt.Sprintf("refs/heads/%s", branch)),
		URL:           repoURL,
		SingleBranch:  true,
		Depth:         2,
	})
.....
fmt.Println("Before infinite loop")
	for {
		fmt.Println("Inside infinite loop")
		err = repo.Fetch(&git.FetchOptions{
			Auth: &http.BasicAuth{
		 		Username: "<username>",
		 		Password: "<password>",
		 	},
		})
		if err != nil {
			log.Error(err)
		}
		cIter, err = repo.Log(&git.LogOptions{From: ref.Hash(), FileName: &neededFile})
		_ = cIter.ForEach(func(c *object.Commit) error {
			if cmt.Hash == c.Hash {
				fmt.Println("Commits equal")
			} else if cmt.Hash != c.Hash {
				fmt.Println("Do something")
			}
			return fmt.Errorf("found")
		})

	}

P.S. I need this infinite loop for watching is there any changes in GH.

cc @mcuadros @barnettZQG @ajnavarro

@Asgoret Asgoret changed the title Fethc: object not found Fetch: object not found Jul 6, 2020
@AriehSchneier
Copy link
Contributor

@pjbgf This is probably fixed by #778

@pjbgf
Copy link
Member

pjbgf commented Jun 4, 2023

@AriehSchneier thanks for the heads up. I will close this one as it seems related to the shallow clone issue, as you pointed out.
I know that object not found it is still happening intermittently in different scenarios, but that is being captured on other opened issues.

@pjbgf pjbgf closed this as completed Jun 4, 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