Move RemoteInfo and CloneProto to info package

This commit is contained in:
2024-01-17 08:13:58 -05:00
parent 1e4e9147f1
commit f33199bd7b
12 changed files with 100 additions and 58 deletions

View File

@ -17,6 +17,7 @@ type Cache struct {
Projects []*projects.Project
Aliases []*ProjectAlias
Updated time.Time
Remotes *remotes.Remotes
config *config.Config
readFromFile bool
lock *sync.Mutex // Lock the entire cache
@ -25,7 +26,6 @@ type Cache struct {
file string
log *pterm.Logger
path string
remotes *remotes.Remotes
}
type CacheOpts struct {
@ -161,9 +161,9 @@ func (c *Cache) String() string {
c.Updated.String(),
len(c.Projects),
len(c.Aliases),
len(*c.remotes),
len(*c.Remotes),
)
for _, r := range *c.remotes {
for _, r := range *c.Remotes {
cacheString += " " + r.GetInfo().Host
}
return cacheString
@ -202,7 +202,7 @@ func NewProjectCache(opts *CacheOpts) (*Cache, error) {
lock: &sync.Mutex{},
contentLock: &sync.Mutex{},
log: opts.Logger,
remotes: opts.Remotes,
Remotes: opts.Remotes,
path: opts.ProjectsPath,
}

View File

@ -14,7 +14,7 @@ func (c *Cache) LoadRemotes() {
wg := &sync.WaitGroup{}
writer := pterm.DefaultMultiPrinter
for _, r := range *c.remotes {
for _, r := range *c.Remotes {
if !remote.IsAlive(r) {
c.log.Error("Skipping load of remote, not alive", c.log.Args(
"remote", r.String(),