From a8cde5da23d912ce2b5daa52083bedc296750ff5 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 3 Oct 2025 17:19:35 -0500 Subject: more movement towards state in the PB --- reloadBranches.go | 7 +++---- reloadParseGitConfig.go | 2 +- reloadRepoState.go | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/reloadBranches.go b/reloadBranches.go index 8c66ec6..b5fadb2 100644 --- a/reloadBranches.go +++ b/reloadBranches.go @@ -22,9 +22,8 @@ import ( // actually, this is to attempt to verify absolutely everything // is pushed upstream before doing a rm -rf ~/go/src // TODO: revisit this code in the autotypist later -func (repo *Repo) CheckBranches() bool { +func (repo *Repo) CheckBranches() string { var hashCheck string - var perfect bool = true all := repo.GetBranches() path := filepath.Join(repo.FullPath, ".git/refs/") for _, b := range all { @@ -64,10 +63,10 @@ func (repo *Repo) CheckBranches() bool { // log.Info("notsure why this git show is here", hash) } else { // log.Printf("UNKNOWN BRANCH %-50s %s %s %s\n", repo.GetFullPath(), r.Stdout, cmd, b) - perfect = false + return b } } - return perfect + return "" } func (repo *Repo) GetBranches() []string { diff --git a/reloadParseGitConfig.go b/reloadParseGitConfig.go index 3497754..0a93dd7 100644 --- a/reloadParseGitConfig.go +++ b/reloadParseGitConfig.go @@ -146,7 +146,7 @@ func (repo *Repo) readGitConfig() (string, error) { repo.GitConfig.Branches[currentName].Merge = value default: log.Log(INFO, "error unknown remote:", currentSection, currentName, key, value) - log.Log(INFO, "unknown branch:", line) + log.Info("git .config unknown branch:", line) } case "submodule": // test, ok := rs.gitConfig.submodules[currentName] diff --git a/reloadRepoState.go b/reloadRepoState.go index 9e17add..42482c4 100644 --- a/reloadRepoState.go +++ b/reloadRepoState.go @@ -49,11 +49,11 @@ func (repo *Repo) setRepoState() { return } - if repo.CheckBranches() { - repo.State = "PERFECT" + if b := repo.CheckBranches(); b != "" { + repo.State = "unknown branch " + b return } - repo.State = "unknown branches" + repo.State = "PERFECT" } // returns true if old="v0.2.4" and new="v0.3.3" -- cgit v1.2.3