diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 8c08cbdd..01e09955 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -615,11 +615,15 @@ func EnsureUpToDate(recipeName string) error { func GetDefaultBranch(repo *git.Repository, recipeName string) (plumbing.ReferenceName, error) { recipeDir := path.Join(config.RECIPES_DIR, recipeName) + meta, _ := GetRecipeMeta(recipeName) + if meta.DefaultBranch != "" { + return plumbing.ReferenceName(fmt.Sprintf("refs/heads/%s", meta.DefaultBranch)), nil + } + branch := "master" if _, err := repo.Branch("master"); err != nil { if _, err := repo.Branch("main"); err != nil { - logrus.Debugf("failed to select branch in %s", recipeDir) - return "", err + return "", fmt.Errorf("failed to select default branch in %s", recipeDir) } branch = "main" }