Fetch all references when cloning git source
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-05-04 11:44:34 -07:00
parent 3a8eecf378
commit e3838621a9
1 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import (
"strings"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
)
@ -92,6 +93,13 @@ func (GitDownloader) Download(opts Options) (Type, string, error) {
return 0, "", err
}
err = r.Fetch(&git.FetchOptions{
RefSpecs: []config.RefSpec{"+refs/*:refs/*"},
})
if err != nil {
return 0, "", err
}
if rev != "" {
h, err := r.ResolveRevision(plumbing.Revision(rev))
if err != nil {