Skip to content

Commit

Permalink
cmd/go: "go get" don't ignore git default branch
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
frederich authored and rsc committed May 12, 2015
1 parent 51021cc commit 29dc4b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cmd/go/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down

0 comments on commit 29dc4b4

Please sign in to comment.