mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 01:39:06 +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(
|
cmd := exec.Command(
|
||||||
gitProgram,
|
gitProgram,
|
||||||
"clone",
|
"clone",
|
||||||
|
"--depth=1",
|
||||||
repoSpec.CloneSpec(),
|
repoSpec.CloneSpec(),
|
||||||
repoSpec.Dir.String())
|
repoSpec.Dir.String())
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
@@ -46,10 +47,23 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
|
|||||||
|
|
||||||
cmd = exec.Command(
|
cmd = exec.Command(
|
||||||
gitProgram,
|
gitProgram,
|
||||||
"checkout",
|
"fetch",
|
||||||
|
"--depth=1",
|
||||||
|
"origin",
|
||||||
repoSpec.Ref)
|
repoSpec.Ref)
|
||||||
cmd.Dir = repoSpec.Dir.String()
|
cmd.Dir = repoSpec.Dir.String()
|
||||||
out, err = cmd.CombinedOutput()
|
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 {
|
if err != nil {
|
||||||
log.Printf("Error checking out ref: %s", out)
|
log.Printf("Error checking out ref: %s", out)
|
||||||
return errors.Wrapf(err, "trouble checking out %s", repoSpec.Ref)
|
return errors.Wrapf(err, "trouble checking out %s", repoSpec.Ref)
|
||||||
|
|||||||
Reference in New Issue
Block a user