diff options
Diffstat (limited to 'doDirty.go')
| -rw-r--r-- | doDirty.go | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -16,29 +16,35 @@ func doDirty() { me.forge.PrintHumanTableDirty(me.found) } -func doCheckDirtyAndConfigSave() { +func straightCheckDirty() int { var count int + var total int now := time.Now() - // log.Info("before findAll()") - all := me.found.SortByFullPath() + all := me.found.All() for all.Scan() { repo := all.Next() - // log.Info("before isDirty()") - dirty := repo.IsDirty() - if repo.CheckDirty() { + total += 1 + if repo.IsDirty() { count += 1 - if me.found.AppendByGoPath(repo) { - log.Info("doCheckDirtyAndConfigSave() repo already existed", repo.GetGoPath()) - } - if !dirty { - configSave = true - } - } else { - if dirty { - configSave = true - } } } - log.Printf("dirty check (%d repos) took:%s\n", count, shell.FormatDuration(time.Since(now))) - me.forge.SetConfigSave(configSave) + log.Printf("rill dirty check (%d dirty repos) (%d total repos) took:%s\n", count, total, shell.FormatDuration(time.Since(now))) + return count +} + +func doCheckDirtyAndConfigSave() { + start := straightCheckDirty() + now := time.Now() + // log.Info("before findAll()") + all := me.found.All() + for all.Scan() { + repo := all.Next() + repo.CheckDirty() + } + end := straightCheckDirty() + log.Printf("dirty check (%d dirty repos) (%d total repos) took:%s\n", end, me.found.Len(), shell.FormatDuration(time.Since(now))) + if start != end { + // todo: use internal forgepb configsave flag. should work? + me.forge.ConfigSave() + } } |
