From d9ed0838c403e982f572d108542bcc16705049d9 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 5 Oct 2025 20:04:38 -0500 Subject: logic for branch testing --- gitTag.common.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'gitTag.common.go') diff --git a/gitTag.common.go b/gitTag.common.go index 7535cd9..ac0f09c 100644 --- a/gitTag.common.go +++ b/gitTag.common.go @@ -85,19 +85,8 @@ func (repo *Repo) IsBranchRemote(brname string) bool { // this is the correct way. uses 'git show-ref' func (repo *Repo) IsDevelRemote() bool { - if repo.Tags == nil { - return false - } - devname := repo.GetDevelBranchName() - refname := "refs/remotes/origin/" + devname - ref := repo.Tags.FindByRefname(refname) - if ref == nil { - // log.Info("did not found refname!!!!!!!!", refname) - return false - } - // log.Info("found refname!!!!!!!!") - return true + return repo.IsBranchRemote(devname) } // find a branch namm @@ -124,6 +113,21 @@ func (repo *Repo) IsBranch(findname string) bool { return false } +func (repo *Repo) IsBranchLocal(findname string) *GitTag { + for t := range repo.Tags.IterAll() { + if !strings.HasPrefix(t.Refname, "refs/heads") { + continue + } + path, filename := filepath.Split(t.Refname) + log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) + if filename == findname { + log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath()) + return t + } + } + return nil +} + func (repo *Repo) IsLocalBranch(findname string) bool { for t := range repo.Tags.IterAll() { if !strings.HasPrefix(t.Refname, "refs/heads") { -- cgit v1.2.3