summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-17 01:15:17 -0600
committerJeff Carr <[email protected]>2024-12-17 01:15:17 -0600
commitb2e51ccb9efc326fda8615b1d2ad9f2ea3f16652 (patch)
tree2c754b6fa07b76d4676498dd5de5bf75b2b509a6 /init.go
parent1369d2df3168426e450dd07314dcaf82dccf232c (diff)
improve Init()
Diffstat (limited to 'init.go')
-rw-r--r--init.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/init.go b/init.go
index efb2b64..4ece518 100644
--- a/init.go
+++ b/init.go
@@ -34,25 +34,34 @@ func Init() *Forge {
log.Info("forgepb.Scan() Scan found", end-start, "new git repositories.")
}
- if f.updateAll() {
+ f.updateAll()
+
+ if f.configSave {
f.ConfigSave()
+ f.configSave = false
}
log.Info("update() check took", shell.FormatDuration(time.Since(now)))
return f
}
-func (f *Forge) updateAll() bool {
- var configSave bool
+func (f *Forge) updateAll() {
all := f.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
+ if !repo.IsValidDir() {
+ log.Printf("%10s %-50s", "old?\n", repo.GoPath)
+ f.Repos.DeleteByGoPath(repo.GoPath)
+ f.configSave = true
+ continue
+ }
+
if repo.RepoChanged() {
- configSave = true
+ f.configSave = true
log.Info("repo changed", repo.StateChange, repo.FullPath)
+ repo.Reload()
}
}
- return configSave
}
// only init's the protobuf. intended to not scan or change anything