diff options
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) |
