diff options
| author | Jeff Carr <[email protected]> | 2025-01-18 15:50:06 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-18 15:50:06 -0600 |
| commit | cbbd43f7b59cee14ed3c83d1da33a04cf8e73bbc (patch) | |
| tree | 173f1d0d15b66962f16d3e3366f685da0269cda4 /doExamine.go | |
| parent | 4444e942ea0c179f94ef4baa8d8dc268f807a8f4 (diff) | |
start a 'clean' argv option
Diffstat (limited to 'doExamine.go')
| -rw-r--r-- | doExamine.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/doExamine.go b/doExamine.go index 20610da..8cac9d8 100644 --- a/doExamine.go +++ b/doExamine.go @@ -78,7 +78,30 @@ func isNormal(repo *gitpb.Repo) bool { func examineBranch(repo *gitpb.Repo) error { if !isLocal(repo) { - repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"}) + base := filepath.Base(repo.CurrentTag.Refname) + if base == repo.GetUserBranchName() { + log.Info("The user branch also has a remote branch", repo.CurrentTag.Refname) + log.Info("TODO: verify the remote branch is out of date", repo.CurrentTag.Refname) + log.Info("TODO: delete the remote branch", repo.CurrentTag.Refname) + return nil + } + + if repo.Exists(filepath.Join(".git/refs/heads", base)) { + repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"}) + repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/remotes/origin", base)}) + repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/heads", base)}) + log.Info("why is this local branch a problem?", repo.CurrentTag.Refname) + } else { + repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"}) + log.Info("why is this non-local branch a problem?", repo.CurrentTag.Refname) + r, err := repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/remotes/origin", base)}) + if err == nil { + cmd := []string{"git", "show", "-s", "--format=\"%H %ae %as %s\"", r.Stdout[0]} + repo.RunVerbose(cmd) + log.Info(cmd) + return nil + } + } return fmt.Errorf("%s repo.CurrentTag is not local: %s. Don't proceed yet", repo.GetGoPath(), repo.CurrentTag.Refname) } dcount, err := showNotMaster(repo) |
