check for "normal" repo states

This commit is contained in:
Jeff Carr 2025-07-21 22:24:59 -05:00
parent 5b5d262ce4
commit a21d17dda9
1 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,12 @@ import (
func doDirty() { func doDirty() {
doCheckDirtyAndConfigSave() 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() found := findDirty()
if argv.Verbose { if argv.Verbose {
me.forge.PrintHumanTableDirty(found) 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 { func straightCheckDirty() int {
var count int var count int
// var total int // var total int
@ -45,6 +66,7 @@ func doCheckDirty(repo *gitpb.Repo) error {
return nil return nil
} }
// recheck every repo's dirty state according to 'git'
func doCheckDirtyAndConfigSave() { func doCheckDirtyAndConfigSave() {
start := straightCheckDirty() start := straightCheckDirty()