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

Change git package to use a shallow git clone #487

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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