Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 4838019

Browse files
authored
Merge pull request #5 from sgreben/feature/shallow
Use shallow single-branch clone, remove git indices
2 parents 72ae652 + a4e09c8 commit 4838019

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io/ioutil"
66
"os"
77
"os/exec"
8+
"path/filepath"
89

910
"github.com/jessevdk/go-flags"
1011
"github.com/nritholtz/stdemuxerhook"
@@ -37,7 +38,7 @@ func init() {
3738

3839
func gitClone(repository string, version string, moduleName string) {
3940
log.Printf("[*] Checking out %s of %s \n", version, repository)
40-
cmd := exec.Command("git", "clone", "-b", version, repository, moduleName)
41+
cmd := exec.Command("git", "clone", "--single-branch", "--depth=1", "-b", version, repository, moduleName)
4142
cmd.Dir = opts.ModulePath
4243
err := cmd.Run()
4344
if err != nil {
@@ -71,5 +72,6 @@ func main() {
7172
os.MkdirAll(opts.ModulePath, os.ModePerm)
7273
for key, module := range config {
7374
gitClone(module.Source, module.Version, key)
75+
os.RemoveAll(filepath.Join(opts.ModulePath, key, ".git"))
7476
}
7577
}

0 commit comments

Comments
 (0)