summaryrefslogtreecommitdiff
path: root/doDirty.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-17 10:59:05 -0600
committerJeff Carr <[email protected]>2025-01-17 10:59:05 -0600
commit9acbb24284ecda4f5ace1cb3d200e363c47c8725 (patch)
tree7af266bff19df14c0961d6f05e1df9e4895c5e77 /doDirty.go
parentaf84727178d1fbe1df04a5f8ee536798f3761d6d (diff)
start an 'examine' argv
Diffstat (limited to 'doDirty.go')
-rw-r--r--doDirty.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/doDirty.go b/doDirty.go
new file mode 100644
index 0000000..e7c5b8b
--- /dev/null
+++ b/doDirty.go
@@ -0,0 +1,44 @@
+package main
+
+import (
+ "time"
+
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func doDirty() {
+ findAll() // select all the repos
+ doCheckDirtyAndConfigSave()
+ me.found = new(gitpb.Repos)
+ findDirty()
+ me.forge.PrintHumanTableDirty(me.found)
+}
+
+func doCheckDirtyAndConfigSave() {
+ var count int
+ now := time.Now()
+ // log.Info("before findAll()")
+ all := me.found.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ // log.Info("before isDirty()")
+ dirty := repo.IsDirty()
+ if repo.CheckDirty() {
+ 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)
+}