From e3838621a9f0be37bb6a217f0c1bfb6db89b7189 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Thu, 4 May 2023 11:44:34 -0700 Subject: [PATCH] Fetch all references when cloning git source --- internal/dl/git.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/dl/git.go b/internal/dl/git.go index 9650575..404e850 100644 --- a/internal/dl/git.go +++ b/internal/dl/git.go @@ -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 {