From: Meng Zhuo Date: Tue, 27 Oct 2015 07:36:38 +0000 (+0800) Subject: cmd/go: use shallow clones for new git checkouts X-Git-Tag: go1.6beta1~558 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bc1f9d20b40998b87c9a5f56f2b22595de65c2d4;p=gostls13.git cmd/go: use shallow clones for new git checkouts 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 --- diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go index a1100960bf..6305175fd1 100644 --- a/src/cmd/go/vcs.go +++ b/src/cmd/go/vcs.go @@ -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