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)
default: install-verbose
# FORGE_VERBOSE=true forge list |head -n 20
forge
vet:
@GO111MODULE=off go vet

View File

@ -6,8 +6,11 @@ package main
// checks that repos are in a "normal" state
import (
"path/filepath"
"strings"
"time"
"go.wit.com/lib/config"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"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("TODO: list the repos here. forge patch repos?")
dumpWorkRepos()
configSave = true
config.SetChanged("repos", true)
return false
}
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 also verifies that
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() == "" {
me.forge.VerifyBranchNames(repo)
configSave = true
log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath())
}
if repo.GetMasterBranchName() == "" {
return log.Errorf("master branch name blank")
err = log.Errorf("master branch name blank")
}
if repo.GetDevelBranchName() == "" {
return log.Errorf("devel branch name blank")
err = log.Errorf("devel branch name blank")
}
if repo.GetUserBranchName() == "" {
return log.Errorf("user branch name blank")
err = log.Errorf("user branch name blank")
}
if 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())
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
configSave = true
log.Info("changing to user branch", repo.FullPath)
repo.CheckoutUser()
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("")
}
// me.forge.RillRepos(reloadCheck)
// me.forge.ScanGoSrc()
me.forge.ScanRepoDir()
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
// initialize patches
doPatchInit()