From 2574ec733a812a747b3e4075f8affc862453034f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 13 Dec 2024 16:18:25 -0600 Subject: IsLocalBranch() --- currentVersions.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'currentVersions.go') diff --git a/currentVersions.go b/currentVersions.go index 9026149..beecc4f 100644 --- a/currentVersions.go +++ b/currentVersions.go @@ -211,6 +211,28 @@ func (repo *Repo) IsBranch(findname string) bool { return false } +// todo: redo this and above. both are messed up. ignore for now until things are stable +func (repo *Repo) IsLocalBranch(findname string) bool { + loop := repo.Tags.All() + for loop.Scan() { + t := loop.Next() + // log.Info("LocalTagExists() tag:", t.Refname) + + tagname := t.Refname + if strings.HasPrefix(tagname, "refs/heads") { + continue + } + path, filename := filepath.Split(tagname) + log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GoPath) + if filename == findname { + log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GoPath) + return true + } + } + log.Log(GITPB, "did not find tag:", findname, "in", repo.GoPath) + return false +} + func trimNonNumericFromStart(s string) string { for i, r := range s { if unicode.IsDigit(r) { -- cgit v1.2.3