diff --git a/cli/internal/validate.go b/cli/internal/validate.go index 36f72679..7a66444d 100644 --- a/cli/internal/validate.go +++ b/cli/internal/validate.go @@ -42,10 +42,8 @@ func ValidateRecipe(c *cli.Context, opts ...runtime.Option) recipe.Recipe { } } - if conf.EnsureRecipeLatest { - if err := recipe.EnsureLatest(recipeName, conf); err != nil { - logrus.Fatal(err) - } + if err := recipe.EnsureLatest(recipeName, conf); err != nil { + logrus.Fatal(err) } logrus.Debugf("validated %s as recipe argument", recipeName) @@ -110,10 +108,8 @@ func ValidateRecipeWithPrompt(c *cli.Context, opts ...runtime.Option) recipe.Rec logrus.Fatal(err) } - if conf.EnsureRecipeLatest { - if err := recipe.EnsureLatest(recipeName, conf); err != nil { - logrus.Fatal(err) - } + if err := recipe.EnsureLatest(recipeName, conf); err != nil { + logrus.Fatal(err) } logrus.Debugf("validated %s as recipe argument", recipeName) diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index d7b015ae..cd47f820 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -339,6 +339,10 @@ func EnsureVersion(recipeName, version string) error { // EnsureLatest makes sure the latest commit is checked out for a local recipe repository func EnsureLatest(recipeName string, conf *runtime.Config) error { + if !conf.EnsureRecipeLatest { + return nil + } + recipeDir := path.Join(config.RECIPES_DIR, recipeName) isClean, err := gitPkg.IsClean(recipeDir)