Closed mvdan closed 2 years ago
Thanks for reporting this. I'll be able to look more into it after Friday.
Off the top of my head (no pun intended), I've seen similar things in the past, and I think this might be related to gopkg.in service doing a hacky edit on the git information it serves, which does not quite match what a normal repository would serve. The solution might be to try to submit a PR to gopkg.in to make it serve git information that's more in line with what one would expect, or update Go Package Store to be able to deal with it.
Two questions:
master
version of Go Package Store and all of its dependencies? I.e., did you do go get -u github.com/shurcooL/Go-Package-Store/cmd/Go-Package-Store
recently?git --version
print?Ok, I can reproduce too:
$ go get -u gopkg.in/sourcemap.v1
$ Go-Package-Store
Using all Go packages in GOPATH.
Go Package Store server is running at http://localhost:7043/updates.
skipping "gopkg.in/sourcemap.v1" because of remote error:
no HEAD branch
It also affects gostatus
in a similar way:
$ gostatus -v gopkg.in/sourcemap.v1
2017/03/16 10:33:09 gopkg.in/sourcemap.v1: no HEAD branch
? gopkg.in/sourcemap.v1/...
? Unreachable remote (check your connection)
Are you using the latest master version of Go Package Store and all of its dependencies?
Yes.
What does git --version print?
git version 2.12.0
For completeness, this is go version devel +d5dc490519 Thu Mar 16 02:44:16 2017 +0000 linux/amd64
.
I also thought gopkg.in
could be to blame. I've had issues with it in the past, especially with repos disappearing and it returning non-git replies to requests.
The underlying issue is in github.com/shurcooL/vcsstate
package, and it can be reproduced with:
$ goexec -quiet '
rv, err := vcsstate.NewRemoteVCS(vcs.ByCmd("git"))
if err != nil {
log.Fatalln(err)
}
branch, revision, err := rv.RemoteBranchAndRevision("https://gopkg.in/sourcemap.v1")
fmt.Printf("branch = %q\nrevision = %q\nerr = %v\n", branch, revision, err)'
branch = ""
revision = "6e83acea0053641eff084973fee085f0c193c61a"
err = HEAD branch not found in ls-remote output
Basically, it's not able to deduct what is the "default branch" from the remote.
Given that go get -u gopkg.in/sourcemap.v1
seems to work without errors, it's more likely this is a bug in vcsstate
rather than incorrect output from gopkg.in
. But it's also possible go get
behavior is not strict about following specs.
I'll look more into it after Friday.
No hurry, just wanted to bring it up so I wouldn't forget about it :) Thanks for looking into it!
I've created https://github.com/niemeyer/gopkg/issues/54 which I believe is the root issue that needs to be resolved. Once it is, everything here should work.
I could try to add some hacky workarounds for gopkg.in
import paths in the meantime, but I'd rather not do that.
Below are some notes for my reference.
curl -A 'git/2:2.1.1+github-607-gfba4028' 'https://github.com/go-sourcemap/sourcemap/info/refs?service=git-upload-pack'
curl -A 'git/2:2.1.1+github-607-gfba4028' 'https://gopkg.in/sourcemap.v1/info/refs?service=git-upload-pack'
git ls-remote --symref 'https://github.com/go-sourcemap/sourcemap' HEAD 'refs/heads/*'
git ls-remote --symref 'https://gopkg.in/sourcemap.v1' HEAD 'refs/heads/*'
Now it also throws local revision is empty
sometimes:
skipping "gopkg.in/sourcemap.v1" because of remote error:
no HEAD branch
skipping "gopkg.in/src-d/go-git.v4" because:
local revision is empty
That's unexpected. Was it a one-off thing, or does it happen reproducibly?
What does gostatus -v 'gopkg.in/src-d/go-git.v4'
print for you, if you have the latest version of gostatus
(and its dependencies)?
Apologies for the late reply.
Was it a one-off thing, or does it happen reproducibly?
Ran again today, the same output.
What does gostatus -v 'gopkg.in/src-d/go-git.v4' print for you
$ gostatus -v 'gopkg.in/src-d/go-git.v4'
b # gopkg.in/src-d/go-git.v4/...
b Non-default branch checked out
# Remote URL doesn't match repo URL inferred from import path:
(actual) git@github.com:mvdan/go-git.git
(expected) git@gopkg.in:src-d/go-git.v4
Note that the branch is v4...upstream/v4
as it should be. And the remotes are upstream
and origin
as explained above.
Edit: by above I meant #73.
Also, running the latest version of your programs and their deps (unless Go-Package-Store
isn't working properly, ha!)
Thanks.
I investigated the gopkg.in/src-d/go-git.v4
issue, and figured out what's going on. See #74.
Also seeing the same or similar issue:
% Go-Package-Store -govendor vendor/vendor.json
Reading the list of Go packages from vendor.json file: vendor/vendor.json
Go Package Store server is running at http://localhost:7043/updates.
skipping "cloud.google.com/go" because of remote error:
HEAD branch not found in ls-remote output
skipping "google.golang.org/api" because of remote error:
HEAD branch not found in ls-remote output
@bits01, this issue is about gopkg.in repos only (I've renamed it to better reflect that). What you're seeing is not gopkg.in, so it might be a real issue. Can you open a new issue and provide more information on how I can reproduce it?
@shurcooL issue #79 thank you for looking into it.
I got the following:
I went to the repo, confirmed it was on
master
trackingorigin/master
, did agit pull
and it worked, pulling a few new commits that hadn't been fetched yet.Also confirmed that
HEAD
exists and points to the same commit asmaster
.What could have caused that error?
Even after doing those commands and being up to date, I still get the same error. I can give you a full copy of the repo clone in this state that triggers the bug.