diff options
| author | Jens Frederich <jfrederich@gmail.com> | 2015-02-19 21:37:38 +0100 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-05-12 16:12:46 +0000 |
| commit | 29dc4b40f85fdb0985eea3e718385dc3c6cd22b7 (patch) | |
| tree | 18767cc368828713bceb519deac929d98ea85b76 | |
| parent | 51021cc83f54964aa5e6a71cdf2206ae169acbb8 (diff) | |
| download | go-29dc4b40f85fdb0985eea3e718385dc3c6cd22b7.tar.xz | |
cmd/go: "go get" don't ignore git default branch
Any Git branch can be the default branch not only master. Removing
hardwired 'checkout master', and using 'checkout {tag}' is the best
choice. It works with and without a master branch. Furthermore it
resolves the Github default branch issue. Changing Github default
branch is effectively changing HEAD.
Fixes #9032
Change-Id: I19a1221bcefe0806e7556c124c6da7ac0c2160b5
Reviewed-on: https://go-review.googlesource.com/5312
Reviewed-by: Russ Cox <rsc@golang.org>
| -rw-r--r-- | src/cmd/go/vcs.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go index 408104d776..2179000afd 100644 --- a/src/cmd/go/vcs.go +++ b/src/cmd/go/vcs.go @@ -115,8 +115,12 @@ var vcsGit = &vcsCmd{ tagLookupCmd: []tagCmd{ {"show-ref tags/{tag} origin/{tag}", `((?:tags|origin)/\S+)$`}, }, - tagSyncCmd: "checkout {tag}", - tagSyncDefault: "checkout master", + tagSyncCmd: "checkout {tag}", + // both createCmd and downloadCmd update the working dir. + // No need to do more here. We used to 'checkout master' + // but that doesn't work if the default branch is not named master. + // See golang.org/issue/9032. + tagSyncDefault: "", scheme: []string{"git", "https", "http", "git+ssh"}, pingCmd: "ls-remote {scheme}://{repo}", |
