diff options
| author | Jeff Carr <[email protected]> | 2025-01-28 17:03:56 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-28 17:03:56 -0600 |
| commit | 51ec39d1579c6bd89d6c5c38a1ff2879c37d3d03 (patch) | |
| tree | ee793a1a3c0e909e200e145a5e8a59587b81ea1a /doExamine.go | |
| parent | 7402aaded7b9f9587eb5ba863b732c9c9e8ee9fe (diff) | |
cleanup argv handling. go-arg saves the day
Diffstat (limited to 'doExamine.go')
| -rw-r--r-- | doExamine.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/doExamine.go b/doExamine.go index f87b411..c6b9091 100644 --- a/doExamine.go +++ b/doExamine.go @@ -54,7 +54,7 @@ func doExamine() error { dur := time.Since(ctime) log.Printf("UNKNOWN BRANCH %-50s %s %4s %s\n", repo.GetFullPath(), tag.Hash, shell.FormatDuration(dur), tag.Refname) err := examineBranch(repo) - if argv.Examine.Fix != nil { + if argv.Clean.Examine.Fix != nil { if err != nil { badExit(err) } @@ -112,12 +112,14 @@ func examineBranch(repo *gitpb.Repo) error { return fmt.Errorf("repo.CurrentTag == nil") } - if repo.CurrentTag.Refname == "jcarr" { - return requiresGitPush(repo, "jcarr") + userbranch := repo.GetUserBranchName() + + if repo.CurrentTag.Refname == userbranch { + return requiresGitPush(repo, userbranch) } - if repo.CurrentTag.Refname == "origin/jcarr" { - return requiresGitPush(repo, "jcarr") + if repo.CurrentTag.Refname == "origin/"+userbranch { + return requiresGitPush(repo, userbranch) } if len(dcount) == 0 { @@ -130,7 +132,7 @@ func examineBranch(repo *gitpb.Repo) error { err = fmt.Errorf("examineBranch() branch differs. patch diff len == 0. PROBABLY DELETE BRANCH %s", repo.CurrentTag.Refname) log.Info(err) cmd := repo.ConstructGitDiffLog(repo.CurrentTag.Refname, repo.GetMasterBranchName()) - if argv.Examine.Fix == nil { + if argv.Clean.Examine.Fix == nil { log.Info(repo.GetGoPath(), cmd) } else { if _, err := repo.RunVerbose(cmd); err != nil { @@ -138,7 +140,7 @@ func examineBranch(repo *gitpb.Repo) error { } } cmd = repo.ConstructGitDiffLog(repo.GetMasterBranchName(), repo.CurrentTag.Refname) - if argv.Examine.Fix == nil { + if argv.Clean.Examine.Fix == nil { log.Info(repo.GetGoPath(), cmd) } else { if _, err := repo.RunVerbose(cmd); err != nil { @@ -147,7 +149,7 @@ func examineBranch(repo *gitpb.Repo) error { } cmd = []string{"git", "branch", "-D", repo.CurrentTag.Refname} log.Info(repo.GetGoPath(), "TRY THIS:", cmd) - if argv.Examine.Fix == nil { + if argv.Clean.Examine.Fix == nil { log.Info(repo.GetGoPath(), "TODO: CHECK REMOTE BRANCH DOES NOT EXIST", repo.CurrentTag.Refname) repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"}) } else { @@ -266,7 +268,7 @@ func requiresGitPush(repo *gitpb.Repo, branchName string) error { if b1 != 0 { log.Info(branchName, "vs origin count b1 != 0, b2 ==", b1, b2) log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", b1) - if argv.Examine.Fix != nil { + if argv.Clean.Examine.Fix != nil { return gitPushStrict(repo, branchName) } return nil |
