From a21d17dda963eec946ca5f2e40d2a8a9aee9e009 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 21 Jul 2025 22:24:59 -0500 Subject: [PATCH] check for "normal" repo states --- doDirty.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doDirty.go b/doDirty.go index 49acbfe..75deccd 100644 --- a/doDirty.go +++ b/doDirty.go @@ -13,6 +13,12 @@ import ( func doDirty() { doCheckDirtyAndConfigSave() + if allerr := me.forge.RillRepos(checkNormalRepoState); len(allerr) != 0 { + log.Info("Some repos are not in a 'normal' state. error count =", len(allerr)) + for repo, err := range allerr { + log.Info("repo not normal", repo.GetFullPath(), err) + } + } found := findDirty() if argv.Verbose { me.forge.PrintHumanTableDirty(found) @@ -21,6 +27,21 @@ func doDirty() { } } +// 99% of the time, the repos during development should be on your user branch. +// error out if it's not +// this checks to see if a devel and user branch exist +// this needs to run each time in case repos were added manually by the user +// this also verifies that +func checkNormalRepoState(repo *gitpb.Repo) error { + if err := repo.MakeLocalDevelBranch(); err != nil { + return err + } + if repo.GetCurrentBranchName() != repo.GetUserBranchName() { + return repo.CheckoutUser() + } + return nil +} + func straightCheckDirty() int { var count int // var total int @@ -45,6 +66,7 @@ func doCheckDirty(repo *gitpb.Repo) error { return nil } +// recheck every repo's dirty state according to 'git' func doCheckDirtyAndConfigSave() { start := straightCheckDirty()