diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index c81d693f..816aa55e 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -24,6 +24,7 @@ import ( composetypes "github.com/docker/cli/cli/compose/types" "github.com/docker/distribution/reference" "github.com/go-git/go-git/v5" + gitConfig "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/sirupsen/logrus" ) @@ -616,9 +617,17 @@ func EnsureUpToDate(recipeName string) error { return err } - fetchOpts := &git.FetchOptions{Tags: git.AllTags} + fmt.Println(branch) + fetchOpts := &git.FetchOptions{ + Tags: git.AllTags, + RefSpecs: []gitConfig.RefSpec{ + gitConfig.RefSpec(fmt.Sprintf("%s:%s", branch, branch)), + }, + } if err := repo.Fetch(fetchOpts); err != nil { - return err + if !strings.Contains(err.Error(), "already up-to-date") { + return err + } } opts := &git.PullOptions{