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