summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-18 10:34:13 -0600
committerJeff Carr <[email protected]>2025-01-18 10:34:13 -0600
commit335531e0fbc2c99051723e659ac99624bb09690c (patch)
tree28c2b1786a9c25f4988d8bc44c127f70618cdc88
parent8fabd77b4938faf2572e5b92658f71f934ef5652 (diff)
misc code cleanupsv0.22.47
-rw-r--r--argv.go1
-rw-r--r--doDirty.go42
2 files changed, 25 insertions, 18 deletions
diff --git a/argv.go b/argv.go
index 5d8923e..5c7c345 100644
--- a/argv.go
+++ b/argv.go
@@ -57,6 +57,7 @@ type ConfigAddCmd struct {
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
+ DebName string `arg:"--debname" help:"the name of the debian package (or rpm, etc)"`
Master string `arg:"--master" help:"the git 'master' or 'main' branch name"`
Devel string `arg:"--devel" help:"the git devel branch name"`
User string `arg:"--user" help:"the git user branch name"`
diff --git a/doDirty.go b/doDirty.go
index e7c5b8b..b1d1624 100644
--- a/doDirty.go
+++ b/doDirty.go
@@ -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()
+ }
}