fix: clone also the main branch

Closes coop-cloud/go-abra#65.
This commit is contained in:
decentral1se 2021-09-07 08:12:17 +02:00
parent 2cb0fb8d66
commit 87f0985ebb
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 9 additions and 1 deletions

View File

@ -70,7 +70,15 @@ func EnsureExists(recipe string) error {
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe)
_, err := git.PlainClone(recipeDir, false, &git.CloneOptions{URL: url, Tags: git.AllTags})
if err != nil {
return err
// try with main branch because Git is being a Git
_, err := git.PlainClone(recipeDir, false, &git.CloneOptions{
URL: url,
Tags: git.AllTags,
ReferenceName: plumbing.ReferenceName("refs/heads/main"),
})
if err != nil {
return err
}
}
}