From 0b4f4d76866ccc500112cfe553240c47961258e2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 16 Feb 2024 17:55:13 -0600 Subject: ready to work on creating branches --- tagWindow.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tagWindow.go') diff --git a/tagWindow.go b/tagWindow.go index 80f14cf..f6a349d 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -1,6 +1,7 @@ package repostatus import ( + "path/filepath" "regexp" "slices" "strings" @@ -281,3 +282,33 @@ func (rt *repoTag) Show() { rt.subject.Show() rt.deleteB.Show() } + +func (rs *RepoStatus) TagExists(findname string) bool { + allTags := rs.Tags.ListAll() + for _, t := range allTags { + tagname := t.TagString() + _, filename := filepath.Split(tagname) + if filename == findname { + // log.Info("found tag:", path, filename, "from", rs.Path()) + return true + } + } + return false +} + +func (rs *RepoStatus) LocalTagExists(findname string) bool { + allTags := rs.Tags.ListAll() + for _, t := range allTags { + tagname := t.TagString() + if strings.HasPrefix(tagname, "refs/remotes") { + continue + } + path, filename := filepath.Split(tagname) + log.Log(INFO, "tag:", path, filename, "from", rs.Path()) + if filename == findname { + log.Log(INFO, "found tag:", path, filename, "from", rs.Path()) + return true + } + } + return false +} -- cgit v1.2.3