summaryrefslogtreecommitdiff
path: root/repos.go
blob: a0bce2e8bfebc29b39daea02e1dd921689eb6057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0

package forgepb

import (
	"go.wit.com/lib/protobuf/gitpb"
	"go.wit.com/log"
	"google.golang.org/protobuf/proto"
)

func (f *Forge) PrepareCheckRepos() *gitpb.Repos {
	submit := gitpb.NewRepos()
	for repo := range f.Repos.IterByFullPath() {
		newrepo := new(gitpb.Repo)
		newrepo.Namespace = repo.Namespace
		newrepo.URL = repo.URL
		newrepo.Tags = gitpb.NewGitTags()

		if repo.Tags == nil {
			log.Infof("%s no tags\n", repo.FullPath)
			continue
		}

		if repo.Tags.Master != nil {
			newrepo.Tags.Master = proto.Clone(repo.Tags.Master).(*gitpb.GitTag)
		} else {
			log.Infof("no master tag %s\n", repo.FullPath)
		}
		if repo.Tags.Devel != nil {
			newrepo.Tags.Devel = proto.Clone(repo.Tags.Devel).(*gitpb.GitTag)
		}
		submit.Append(newrepo)
	}
	return submit
}