diff --git a/Makefile b/Makefile index d749cce..4793e06 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/doNormal.go b/doNormal.go index 4c773d0..2973251 100644 --- a/doNormal.go +++ b/doNormal.go @@ -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 } diff --git a/main.go b/main.go index 981f853..8aff206 100644 --- a/main.go +++ b/main.go @@ -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()