diff --git a/cmd/srpmproc/main.go b/cmd/srpmproc/main.go index a6e1946..0a792dc 100644 --- a/cmd/srpmproc/main.go +++ b/cmd/srpmproc/main.go @@ -111,10 +111,16 @@ func mn(_ *cobra.Command, _ []string) { } lastKeyLocation = filepath.Join(usr.HomeDir, ".ssh/id_rsa") } - // create ssh key authenticator - authenticator, err := ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "") - if err != nil { - log.Fatalf("could not get git authenticator: %v", err) + + var authenticator *ssh.PublicKeys + + if tmpFsMode == "" { + var err error + // create ssh key authenticator + authenticator, err = ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "") + if err != nil { + log.Fatalf("could not get git authenticator: %v", err) + } } fsCreator := func(branch string) billy.Filesystem { diff --git a/internal/git.go b/internal/git.go index 81689fb..8831649 100644 --- a/internal/git.go +++ b/internal/git.go @@ -119,27 +119,25 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) *data.ModeData { } _ = tagIter.ForEach(tagAdd) - if len(latestTags) == 0 { - list, err := remote.List(&git.ListOptions{}) + list, err := remote.List(&git.ListOptions{}) + if err != nil { + log.Fatalf("could not list upstream: %v", err) + } + + for _, ref := range list { + if ref.Hash().IsZero() { + continue + } + + commit, err := repo.CommitObject(ref.Hash()) if err != nil { - log.Fatalf("could not list upstream: %v", err) - } - - for _, ref := range list { - if ref.Hash().IsZero() { - continue - } - - commit, err := repo.CommitObject(ref.Hash()) - if err != nil { - log.Printf("could not get commit object for ref %s: %v", ref.Name().String(), err) - continue - } - _ = tagAdd(&object.Tag{ - Name: strings.TrimPrefix(string(ref.Name()), "refs/tags/"), - Tagger: commit.Committer, - }) + log.Printf("could not get commit object for ref %s: %v", ref.Name().String(), err) + continue } + _ = tagAdd(&object.Tag{ + Name: strings.TrimPrefix(string(ref.Name()), "refs/tags/"), + Tagger: commit.Committer, + }) } for _, branch := range latestTags {