mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-24 07:47:02 +00:00
Merge pull request #2579 from pietervincken/re-introduce-shallow-git-clones
Re-introduce shallow git clones for git based remote resources
This commit is contained in:
@@ -33,6 +33,7 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
|
||||
cmd := exec.Command(
|
||||
gitProgram,
|
||||
"clone",
|
||||
"--depth=1",
|
||||
repoSpec.CloneSpec(),
|
||||
repoSpec.Dir.String())
|
||||
out, err := cmd.CombinedOutput()
|
||||
@@ -46,10 +47,23 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
|
||||
|
||||
cmd = exec.Command(
|
||||
gitProgram,
|
||||
"checkout",
|
||||
"fetch",
|
||||
"--depth=1",
|
||||
"origin",
|
||||
repoSpec.Ref)
|
||||
cmd.Dir = repoSpec.Dir.String()
|
||||
out, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Printf("Error fetching ref: %s", out)
|
||||
return errors.Wrapf(err, "trouble fetching %s", repoSpec.Ref)
|
||||
}
|
||||
|
||||
cmd = exec.Command(
|
||||
gitProgram,
|
||||
"checkout",
|
||||
"FETCH_HEAD")
|
||||
cmd.Dir = repoSpec.Dir.String()
|
||||
out, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Printf("Error checking out ref: %s", out)
|
||||
return errors.Wrapf(err, "trouble checking out %s", repoSpec.Ref)
|
||||
|
||||
Reference in New Issue
Block a user