From 87f0985ebbcb34b4d8fe7e7c32457bfe4e1bb8b6 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 7 Sep 2021 08:12:17 +0200 Subject: [PATCH] fix: clone also the main branch Closes https://git.coopcloud.tech/coop-cloud/go-abra/issues/65. --- pkg/recipe/recipe.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 3591724c5..486973b8d 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -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 + } } }