fix: specify refs when fetching tags

See coop-cloud/organising#397
This commit is contained in:
decentral1se 2023-02-02 20:58:38 +01:00
parent 2a88491d7c
commit 71a9155042
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 11 additions and 2 deletions

View File

@ -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{