moved to new dir scan

This commit is contained in:
Jeff Carr 2025-09-13 07:09:13 -05:00
parent c463ec70f0
commit 9cdfface3c
3 changed files with 24 additions and 12 deletions

View File

@ -7,7 +7,7 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
# make andlabs # try the andlabs gui plugin (uses GTK) # make andlabs # try the andlabs gui plugin (uses GTK)
default: install-verbose default: install-verbose
# FORGE_VERBOSE=true forge list |head -n 20 forge
vet: vet:
@GO111MODULE=off go vet @GO111MODULE=off go vet

View File

@ -6,8 +6,11 @@ package main
// checks that repos are in a "normal" state // checks that repos are in a "normal" state
import ( import (
"path/filepath"
"strings"
"time" "time"
"go.wit.com/lib/config"
"go.wit.com/lib/gui/shell" "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
@ -35,7 +38,7 @@ func doNormal() bool {
log.Info("Some repos are not in a 'normal' state. error count =", count) log.Info("Some repos are not in a 'normal' state. error count =", count)
log.Info("TODO: list the repos here. forge patch repos?") log.Info("TODO: list the repos here. forge patch repos?")
dumpWorkRepos() dumpWorkRepos()
configSave = true config.SetChanged("repos", true)
return false return false
} }
return true return true
@ -47,19 +50,31 @@ func doNormal() bool {
// this needs to run each time in case repos were added manually by the user // this needs to run each time in case repos were added manually by the user
// this also verifies that // this also verifies that
func checkNormalRepoState(repo *gitpb.Repo) error { func checkNormalRepoState(repo *gitpb.Repo) error {
var err error
tmp := filepath.Join(me.forge.Config.ReposDir, repo.GetNamespace())
if tmp != repo.FullPath {
log.Infof("%s != %s\n", repo.FullPath, tmp)
if strings.HasPrefix(repo.FullPath, me.forge.Config.ReposDir) {
tmp = strings.TrimPrefix(repo.FullPath, me.forge.Config.ReposDir)
repo.Namespace = tmp
err = log.Errorf("namespace set to filepath")
}
} else {
// log.Infof("%s == %s\n", repo.FullPath, tmp)
}
if repo.GetMasterBranchName() == "" { if repo.GetMasterBranchName() == "" {
me.forge.VerifyBranchNames(repo) me.forge.VerifyBranchNames(repo)
configSave = true
log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath()) log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath())
} }
if repo.GetMasterBranchName() == "" { if repo.GetMasterBranchName() == "" {
return log.Errorf("master branch name blank") err = log.Errorf("master branch name blank")
} }
if repo.GetDevelBranchName() == "" { if repo.GetDevelBranchName() == "" {
return log.Errorf("devel branch name blank") err = log.Errorf("devel branch name blank")
} }
if repo.GetUserBranchName() == "" { if repo.GetUserBranchName() == "" {
return log.Errorf("user branch name blank") err = log.Errorf("user branch name blank")
} }
if repo.GetGoPath() == repo.GetNamespace() { if repo.GetGoPath() == repo.GetNamespace() {
// log.Info(repo.FullPath, "gopath == namespace", repo.GetGoPath(), repo.GetNamespace()) // log.Info(repo.FullPath, "gopath == namespace", repo.GetGoPath(), repo.GetNamespace())
@ -72,11 +87,10 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName()) repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName())
if repo.GetCurrentBranchName() != repo.GetUserBranchName() { if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
configSave = true
log.Info("changing to user branch", repo.FullPath) log.Info("changing to user branch", repo.FullPath)
repo.CheckoutUser() repo.CheckoutUser()
repo.ReloadCheck() repo.ReloadCheck()
return log.Errorf("now on user branch") err = log.Errorf("now on user branch")
} }
return nil return err
} }

View File

@ -66,9 +66,7 @@ func main() {
okExit("") okExit("")
} }
// me.forge.RillRepos(reloadCheck) me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
// me.forge.ScanGoSrc()
me.forge.ScanRepoDir()
// initialize patches // initialize patches
doPatchInit() doPatchInit()