fix: remove single branch option

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2019-06-22 12:17:46 -03:00
parent c45e05f668
commit f578b09846
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
1 changed files with 7 additions and 10 deletions

View File

@ -34,16 +34,13 @@ type Git struct {
func (g *Git) UnpackTarFromBuildContext() (string, error) {
directory := constants.BuildContextDir
parts := strings.Split(g.context, "#")
url := "https://" + parts[0]
branch := "master"
if len(parts) > 1 {
branch = parts[1]
options := git.CloneOptions{
URL: "https://" + parts[0],
Progress: os.Stdout,
}
_, err := git.PlainClone(directory, false, &git.CloneOptions{
URL: url,
Progress: os.Stdout,
ReferenceName: plumbing.ReferenceName(branch),
SingleBranch: true,
})
if len(parts) > 1 {
options.ReferenceName = plumbing.ReferenceName(parts[1])
}
_, err := git.PlainClone(directory, false, &options)
return directory, err
}