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

cmd/go: cannot use 'go get -u' after commit bc1f9d20b40998b87c9a5f56f2b22595de65c2d4 #13206

Closed
siebenmann opened this issue Nov 11, 2015 · 8 comments
Milestone

Comments

@siebenmann
Copy link

After commit bc1f9d2, 'cmd/go: use shallow clones for new git checkouts', it's no longer possible to use 'go get -u'. Attempts to do so error out with a usage error from git:

$ go get -u github.com/rogpeppe/godef
# cd /homes/hawkwind/u0/cks/go/src/github.com/rogpeppe/godef; git pull --depth=1 --ff-only
error: unknown option `ff-only'
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [(<repository> | <group>)...]
   or: git fetch --all [<options>]
[...]

Ordinary 'go get' (still) works.

My version of git is 'git version 2.4.3', which is the standard Fedora Linux 22 package (I'm on x86_64).

Experimentally, running 'git pull --ff-only --depth=1' does not error out. However I don't know if it behaves correctly (ie, forces fast forward only merges), and it prints extra output that 'git pull --ff-only' does not:

$ git pull --ff-only --depth=1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
Already up-to-date.
$ git pull --ff-only
Already up-to-date.

(Thus, simply switching the order here may not be the correct fix.)

@bradfitz bradfitz added this to the Go1.6 milestone Nov 11, 2015
@bradfitz
Copy link
Contributor

I can't reproduce with git version 2.6.2 at least. I haven't tested more than that.

@siebenmann
Copy link
Author

'git pull --depth=1 --ff-only' also fails on Ubuntu 14.04 LTS (git version 1.9.1) but succeeds on FreeBSD 10.something with git 2.6.1, and on Fedora 23 with 2.5.0 (where it prints the extra line of output). Based on the git 2.5.0 changelog I think the fundamental fix for this issue was made in 2.5.0, although it may have been refined later.

(One change is '"git pull" has become more aware of the options meant for underlying "git fetch" and then learned to use parse-options parser'.)

@ahmetb
Copy link

ahmetb commented Nov 11, 2015

Here's a repro: https://travis-ci.org/Azure/go-autorest/builds/90569740

$ go get -u github.com/golang/lint/golint
# cd /home/travis/gopath/src/github.com/Azure/go-autorest/Godeps/_workspace/src/golang.org/x/tools; git pull --depth=1 --ff-only
error: unknown option `ff-only'
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [(<repository> | <group>)...]
   or: git fetch --all [<options>]
    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <path>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune remote-tracking branches no longer on remote
    --recurse-submodules[=<on-demand>]
                          control recursive fetching of submodules
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <depth>       deepen history of shallow clone
    --unshallow           convert to a complete repository

package golang.org/x/tools/go/gcimporter: exit status 1

The command "go get -u github.com/golang/lint/golint" failed and exited with 1 during .

@tcz001
Copy link

tcz001 commented Nov 11, 2015

We have kind of same issue when using travis-ci and it's also having problem when try to go get gopkg.in/check.v1 without update. see both:

https://travis-ci.org/twstrike/coyim/jobs/90568623
and
https://travis-ci.org/twstrike/coyim/jobs/90614014

@rakyll
Copy link
Contributor

rakyll commented Nov 11, 2015

$ git version
git version 2.6.2

I was able to reproduce it with the following on a mac with a previously cloned unshallow golang.org/x/tools repo.

go get  -u golang.org/x/tools/...

I am trying to understand what git pull --depth=1 may mean. Aren't we suppose to unshallow and pull if the repo is shallow?

As a side note, the current behavior of go get -u is messing the GOPATHs if the user is not working with unshallow copies. I think we should immediately revert bc1f9d2 and experiment thoroughly before ever bringing it back.

/cc @rsc

@ahmetb
Copy link

ahmetb commented Nov 11, 2015

I just found out this is only the tip is broken. The issue does not repro on versions such as go1.5.1. In the meanwhile, travis-ci users can add go: 1.5 to their .travis.yml file to prevent it from happening. @tcz001

@gopherbot
Copy link

CL https://golang.org/cl/16832 mentions this issue.

@kostya-sh
Copy link
Contributor

Debian 8.2 comes with git 2.1.4 that doesn't support pull --ff-only. I think go get should support reasonably old versions of git.

@rakyll rakyll closed this as completed in b619d55 Nov 12, 2015
@golang golang locked and limited conversation to collaborators Nov 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants