Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #487 from weaveworks/git-shallow-clone
Browse files Browse the repository at this point in the history
Change git package to use a shallow git clone
  • Loading branch information
squaremo committed Mar 13, 2017
2 parents ae189ac + fd7ab78 commit 954ea38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git/releasing.go → git/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ import (
"github.com/pkg/errors"
)

// Do a shallow clone of the repo. We only need the files, and not the
// history. A shallow clone is marginally quicker, and takes less
// space, than a full clone.
func clone(workingDir, keyData, repoURL, repoBranch string) (path string, err error) {
keyPath, err := writeKey(keyData)
if err != nil {
return "", err
}
defer os.Remove(keyPath)
repoPath := filepath.Join(workingDir, "repo")
args := []string{"clone"}
// --single-branch is also useful, but is implied by --depth=1
args := []string{"clone", "--depth=1"}
if repoBranch != "" {
args = append(args, "--branch", repoBranch)
}
Expand Down

0 comments on commit 954ea38

Please sign in to comment.