]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: use shallow clones for new git checkouts
authorMeng Zhuo <mengzhuo1203@gmail.com>
Tue, 27 Oct 2015 07:36:38 +0000 (15:36 +0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 11 Nov 2015 14:28:58 +0000 (14:28 +0000)
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>
src/cmd/go/vcs.go

index a1100960bffe6fb0b76aff79732a019f43a99ed7..6305175fd1681dbd5c1464227e60ab3e7052a552 100644 (file)
@@ -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