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 failing - but only in GitHub Actions #726

Open
bobg opened this issue Mar 29, 2023 · 3 comments
Open

PlainCloneContext failing - but only in GitHub Actions #726

bobg opened this issue Mar 29, 2023 · 3 comments

Comments

@bobg
Copy link

bobg commented Mar 29, 2023

[It's not a fetch-depth problem.]

Hello! I have some code that calls PlainCloneContext with a local .git dir as the URL. It works fine when I run it on my Macbook, and when I run it on my Linux desktop. And it worked fine in GitHub Actions in a recent version of my project. But it fails on my current feature branch, even though no relevant code has changed.

The project is modver, a package and command-line tool for helping your Go project to obey semantic versioning rules. In the function CompareGitWith, an older and a newer version of a Git repo are compared to each other; the cloning happens in the helper function gitSetup here.

Here is the line in the TestGit unit test that calls CompareGitWith (via an intermediate call to CompareGit). Here is the GitHub Actions workflow that runs that test. And here you can see it working in a commit on the master branch from just a few weeks ago.

But it's failing in this draft PR with an "object not found" error. Example.

Take a look at the last several commits in that PR branch to see the various permutations of things I tried to fix this, to no avail. I am pretty baffled. Any help?

@AriehSchneier
Copy link
Contributor

Is this issue #148?

If it is a workaround is to add this line after your PlainOpen:
_, _ = repo.ResolveRevision(plumbing.Revision(plumbing.ZeroHash.String()))

I have a PR open to fix it.

@bobg
Copy link
Author

bobg commented Mar 29, 2023

Thank you @AriehSchneier but apparently not. I tried your workaround and got the same result.

@bobg
Copy link
Author

bobg commented Mar 29, 2023

On the other hand, this workaround (using an https repo URL instead of a local directory) did work.

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