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

x/vgo: fetching broken on older git versions #25102

Closed
flibustenet opened this issue Apr 26, 2018 · 12 comments

Comments

@flibustenet
Copy link

commented Apr 26, 2018

What version of Go are you using (go version)?

go version go1.10.1 linux/amd64

Does this issue reproduce with the latest release?

go get -u golang.org/x/vgo (just now)

What did you do?

$ curl -sS https://swtch.com/hello.go >hello.go
$ echo > go.mod
$ vgo build

vgo: resolving import "rsc.io/quote"
vgo: import "github.com/you/hello" ->
	import "rsc.io/quote": git fetch --depth=1 https://github.com/rsc/quote c4d4236f92427c64bfbcf1cc3f8142ab18f30b22 in /home/wilk/go/src/v/cache/vcswork/af72e8eb60eb05152f7c8a104173245f2891ad0a76bf7d2886307ccb7b12ed20: exit status 128:
	error: no such remote ref c4d4236f92427c64bfbcf1cc3f8142ab18f30b22

The same with others imports.

Maybe @rsc could ping us for alpha releases where we can begin to test new improvements ? (we are so impatient !)

@gopherbot gopherbot added this to the vgo milestone Apr 26, 2018

@utrack

This comment has been minimized.

Copy link

commented Apr 26, 2018

Same for me, but with uber/zap repo.
It can't find ref that's definitely there in the upstream.

@oiooj

This comment has been minimized.

Copy link
Member

commented Apr 26, 2018

I can't reproduce @flibustenet 's issue. Everything is OK here, and the remote ref c4d4236f92427c64bfbcf1cc3f8142ab18f30b22 exists.

$ ~/vgo build -v
vgo: resolving import "rsc.io/quote"
vgo: finding rsc.io/quote (latest)
vgo: adding rsc.io/quote v1.5.2
vgo: finding rsc.io/quote v1.5.2
vgo: finding rsc.io/sampler v1.3.0
vgo: finding golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
vgo: downloading rsc.io/quote v1.5.2
vgo: downloading rsc.io/sampler v1.3.0
vgo: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
golang.org/x/text/internal/tag
golang.org/x/text/language
rsc.io/sampler
rsc.io/quote
github.com/you/hello

ref fetch

$ git fetch --depth=1 https://github.com/rsc/quote c4d4236f92427c64bfbcf1cc3f8142ab18f30b22
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 9 (delta 0), reused 9 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
From https://github.com/rsc/quote
 * branch            c4d4236f92427c64bfbcf1cc3f8142ab18f30b22 -> FETCH_HEAD
@eraclitux

This comment has been minimized.

Copy link

commented Apr 26, 2018

I'm having same issue, @oiooj can you attach git --version?

@oiooj

This comment has been minimized.

Copy link
Member

commented Apr 26, 2018

Sure. @eraclitux

$ git version
git version 2.14.3 (Apple Git-98)
@eraclitux

This comment has been minimized.

Copy link

commented Apr 26, 2018

Thank you, with same version everything if fine even with me but using git version 2.11.0 shipped with golang:latest container I got:

git fetch --depth=1 https://github.com/aws/aws-sdk-go 1f8fb9d0919e5a58992207db9512a03f76ab0274
error: no such remote ref 1f8fb9d0919e5a58992207db9512a03f76ab0274

The ref exists and same command was working at least 5 days ago 🤔

@eraclitux

This comment has been minimized.

Copy link

commented Apr 26, 2018

I'm not a git guru but the problem seems that for older versions the fetch syntax should be:

git fetch --depth=1 https://github.com/aws/aws-sdk-go :1f8fb9d0919e5a58992207db9512a03f76ab0274
@oiooj

This comment has been minimized.

Copy link
Member

commented Apr 26, 2018

A release note from git 2.14.3:

   "git fetch <there> <src>:<dst>" allows an object name on the <src>
   side when the other side accepts such a request since Git v2.5, but
   the documentation was left stale.

@ALTree ALTree changed the title x/vgo current vgo broken x/vgo: fetching broken on older git versions Apr 26, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Apr 26, 2018

Change https://golang.org/cl/109555 mentions this issue: cmd/go/internal/modfetch: make it compatible with older 'git fetch'

@flibustenet

This comment has been minimized.

Copy link
Author

commented Apr 26, 2018

on Debian Stretch

$ git --version
git version 2.11.0

It was a good idea to remove the need of git !

@rsc

This comment has been minimized.

Copy link
Contributor

commented Apr 26, 2018

I commented on the CL:

This is very incorrect. The form

git fetch remote xxx:yyy

says fetch xxx from remote and give it the local name yyy.

If you omit xxx then you get the remote HEAD.
So when you run

git fetch remote :1234567890123456789012345678901234567890

that downloads the remote HEAD and then creates a local ref
for that commit named 1234567890123456789012345678901234567890,
no matter what its actual commit hash is.

Then if you try to use that name in a git command git will print
a warning like:

warning: refname '1234567890123456789012345678901234567890' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,

  git checkout -b $br $(git rev-parse ...)

where "$br" is somehow empty and a 40-hex ref is created. Please
examine these refs and maybe delete them. Turn this message off by
running "git config advice.objectNameWarning false"

Clearly this command is NOT what you want to use.

@oiooj

This comment has been minimized.

@gopherbot

This comment has been minimized.

Copy link

commented Apr 26, 2018

Change https://golang.org/cl/109518 mentions this issue: cmd/go/internal/modfetch/gitrepo: work around old git fetch hash behavior

@golang golang locked and limited conversation to collaborators Apr 26, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants
You can’t perform that action at this time.