mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Merge pull request #3032 from Shell32-Natsu/default-branch
remove default master branch in cloner
This commit is contained in:
@@ -27,9 +27,6 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if repoSpec.Ref == "" {
|
|
||||||
repoSpec.Ref = "master"
|
|
||||||
}
|
|
||||||
cmd := exec.Command(
|
cmd := exec.Command(
|
||||||
gitProgram,
|
gitProgram,
|
||||||
"clone",
|
"clone",
|
||||||
@@ -45,28 +42,30 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
|
|||||||
repoSpec.CloneSpec(), repoSpec.Dir.String())
|
repoSpec.CloneSpec(), repoSpec.Dir.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = exec.Command(
|
if repoSpec.Ref != "" {
|
||||||
gitProgram,
|
cmd = exec.Command(
|
||||||
"fetch",
|
gitProgram,
|
||||||
"--depth=1",
|
"fetch",
|
||||||
"origin",
|
"--depth=1",
|
||||||
repoSpec.Ref)
|
"origin",
|
||||||
cmd.Dir = repoSpec.Dir.String()
|
repoSpec.Ref)
|
||||||
out, err = cmd.CombinedOutput()
|
cmd.Dir = repoSpec.Dir.String()
|
||||||
if err != nil {
|
out, err = cmd.CombinedOutput()
|
||||||
log.Printf("Error fetching ref: %s", out)
|
if err != nil {
|
||||||
return errors.Wrapf(err, "trouble fetching %s", repoSpec.Ref)
|
log.Printf("Error fetching ref: %s", out)
|
||||||
}
|
return errors.Wrapf(err, "trouble fetching %s", repoSpec.Ref)
|
||||||
|
}
|
||||||
|
|
||||||
cmd = exec.Command(
|
cmd = exec.Command(
|
||||||
gitProgram,
|
gitProgram,
|
||||||
"checkout",
|
"checkout",
|
||||||
"FETCH_HEAD")
|
"FETCH_HEAD")
|
||||||
cmd.Dir = repoSpec.Dir.String()
|
cmd.Dir = repoSpec.Dir.String()
|
||||||
out, err = cmd.CombinedOutput()
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = exec.Command(
|
cmd = exec.Command(
|
||||||
|
|||||||
Reference in New Issue
Block a user