Skip to content

Commit

Permalink
cmd/go: use shallow clones for new git checkouts
Browse files Browse the repository at this point in the history
Currently go get will clone the full history of git repos.
We can improve the download waiting time/size by passing depth argument.

The docs about shallow clones and the --depth argument are here:
https://git-scm.com/docs/git-clone
https://git-scm.com/docs/git-pull

Fixes #13078

Change-Id: Ie891d905d9c77f6ecadf7dcd5b44b477f4e079e0
Reviewed-on: https://go-review.googlesource.com/16360
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
mengzhuo authored and bradfitz committed Nov 11, 2015
1 parent 880a689 commit bc1f9d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/go/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ var vcsGit = &vcsCmd{
name: "Git",
cmd: "git",

createCmd: []string{"clone {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"},
downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
createCmd: []string{"clone --depth=1 {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"},
downloadCmd: []string{"pull --depth=1 --ff-only", "submodule update --init --recursive"},

tagCmd: []tagCmd{
// tags/xxx matches a git tag named xxx
Expand Down

0 comments on commit bc1f9d2

Please sign in to comment.