diff options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -29,9 +29,9 @@ func Init() *Forge { f.ScanGoSrc() end := f.Repos.Len() if (end - start) == 0 { - log.Info("forgepb.Scan() Scan did not find new git repositories.") + log.Info("forgepb.Scan() Scan did not find new git repositories. Total =", end) } else { - log.Info("forgepb.Scan() Scan found", end-start, "new git repositories.") + log.Info("forgepb.Scan() Scan found", end-start, "new git repositories. Total =", end) } f.updateAll() @@ -50,8 +50,8 @@ func (f *Forge) updateAll() { repo := all.Next() if !repo.IsValidDir() { - log.Printf("%10s %-50s", "old?\n", repo.GoPath) - f.Repos.DeleteByGoPath(repo.GoPath) + log.Printf("%10s %-50s", "bad git dir\n", repo.FullPath) + f.Repos.DeleteByFullPath(repo.FullPath) f.configSave = true continue } @@ -61,6 +61,14 @@ func (f *Forge) updateAll() { log.Info("repo changed", repo.StateChange, repo.FullPath) repo.Reload() } + if f.Config.IsReadOnly(repo.GetGoPath()) { + if repo.ReadOnly { + } else { + log.Info("readonly flag on repo is wrong", repo.GetGoPath()) + repo.ReadOnly = true + f.configSave = true + } + } } } @@ -109,3 +117,17 @@ func InitPB() *Forge { f.Repos.ConfigLoad() return f } + +func (f *Forge) SetConfigSave(b bool) { + f.configSave = b +} + +// saves the config if there have been changes +func (f *Forge) Exit() { + log.Info("forge.configSave =", f.configSave) + if f.configSave { + f.ConfigSave() + } + log.Info("forge.Exit() ok") + os.Exit(0) +} |
