From d99eb81385a293ccf9bf8f6e902a3a7798bf36a2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 6 Sep 2025 19:21:00 -0500 Subject: [PATCH] start checking the "normal" state every time --- doNormal.go | 1 + doPatch.go | 10 +++++++++- main.go | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doNormal.go b/doNormal.go index 08044ee..12b0eaf 100644 --- a/doNormal.go +++ b/doNormal.go @@ -62,6 +62,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error { if repo.GetCurrentBranchName() != repo.GetUserBranchName() { configSave = true + log.Info("crapnuts") repo.CheckoutUser() repo.Reload() return log.Errorf("now on user branch") diff --git a/doPatch.go b/doPatch.go index 94b2c7a..37f255e 100644 --- a/doPatch.go +++ b/doPatch.go @@ -12,7 +12,11 @@ import ( func doPatchInit() { if me.forge.Patchsets != nil { - log.Info("IGNORE: patches already initalized") + if me.forge.Patchsets.Len() == 0 { + // log.Info("IGNORE: patches are empty") + } else { + log.Info("IGNORE: patches already initalized len =", me.forge.Patchsets.Len()) + } } if err := me.forge.LoadPatchsets(); err != nil { log.Info("patches failed to open", err) @@ -82,6 +86,10 @@ func doPatch() error { me.forge.Patchsets.PrintTable() // return doPatchList() applied := findApplied() + if applied.Len() == 0 { + log.Info("no patches have to appled to the devel branch yet") + return nil + } // for patch := range applied.IterAll() { // log.Info("SEND APPLIED: newhash:", patch.NewHash, "commithash:", patch.CommitHash, "patch", patch.Namespace) // } diff --git a/main.go b/main.go index 8dbefc5..7aa68c1 100644 --- a/main.go +++ b/main.go @@ -99,6 +99,7 @@ func main() { } if argv.Checkout != nil { + me.forge.Config.Mode = forgepb.ForgeMode_MASTER if err := doCheckout(); err != nil { badExit(err) } @@ -120,6 +121,7 @@ func main() { } if argv.Clean != nil { + me.forge.Config.Mode = forgepb.ForgeMode_CLEAN if argv.Clean.Repo != "" { log.Info("only looking at repo:", argv.Clean.Repo) okExit("") @@ -140,11 +142,24 @@ func main() { if argv.Normal != nil { if doNormal() { log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len()) + if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL { + log.Infof("Forge has set the mode to 'Normal'\n") + me.forge.Config.Mode = forgepb.ForgeMode_NORMAL + me.forge.ConfigSave() + } okExit("") } okExit("") } + // if you are in "normal" mode, always run normal every time to catch accidental errors + // for example, if you accidentally changed branches from your user branch + if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL { + if doNormal() { + log.Infof("all %d repos are still normal\n", me.forge.Repos.Len()) + } + } + if argv.Dirty != nil { doDirty() okExit("")