From 6654dbb4102ba0f725f7d82b5f26a7288a68699d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 12 Sep 2025 14:53:39 -0500 Subject: [PATCH] tag handling is still bad --- currentVersions.go | 3 +-- gitTag.common.go | 4 ---- gitTag.printTable.go | 41 +++++++++++++++++++++++++++++++++++++++++ gitTag.proto | 2 +- reloadTags.go | 5 +++++ 5 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 gitTag.printTable.go diff --git a/currentVersions.go b/currentVersions.go index 682d582..fdedb74 100644 --- a/currentVersions.go +++ b/currentVersions.go @@ -144,8 +144,7 @@ func (repo *Repo) gitVersionByName(name string) (string, error) { return strings.TrimSpace(output), nil } if !repo.IsBranch(name) { - // tag does not exist - // log.Log(WARN, "LocalTagExists()", name, "did not exist") + // branch does not exist return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name) } cmd := []string{"git", "describe", "--tags", name} diff --git a/gitTag.common.go b/gitTag.common.go index 8aa76bf..2c83da1 100644 --- a/gitTag.common.go +++ b/gitTag.common.go @@ -83,8 +83,6 @@ func (repo *Repo) IsDevelRemote() bool { // eventually this will be worked out by forge in some future code that hasn't been made yet func (repo *Repo) IsBranch(findname string) bool { for t := range repo.Tags.IterAll() { - // log.Info("LocalTagExists() tag:", t.Refname) - tagname := t.Refname if strings.HasPrefix(tagname, "refs/remotes") { continue @@ -103,10 +101,8 @@ func (repo *Repo) IsBranch(findname string) bool { func (repo *Repo) IsLocalBranch(findname string) bool { for t := range repo.Tags.IterAll() { if !strings.HasPrefix(t.Refname, "refs/heads") { - // log.Info("LocalTagExists() skip tag:", t.Refname) continue } - // log.Info("LocalTagExists() check tag:", t.Refname) path, filename := filepath.Split(t.Refname) log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) if filename == findname { diff --git a/gitTag.printTable.go b/gitTag.printTable.go new file mode 100644 index 0000000..5288753 --- /dev/null +++ b/gitTag.printTable.go @@ -0,0 +1,41 @@ +// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. +// This file was autogenerated with autogenpb v0.5.1 2025-09-12_15:24:32_UTC +// go install go.wit.com/apps/autogenpb@latest +// +// define which structs (messages) you want to use in the .proto file +// Then sort.pb.go and marshal.pb.go files are autogenerated +// +// autogenpb uses it and has an example .proto file with instructions +// + +package gitpb + +import ( + "go.wit.com/lib/cobol" +) + +func (mt *GitTagsTable) PrintTable() { + // log.Info("ShowTable() SENDING TO GUI") + mt.MakeTable() + cobol.PrintTable(mt.pb) +} + +/* +func (mt *GitTagsTable) MakeTable() { + for _, name := range mt.pb.Order { + // log.Info("gitpb: looking for row name()", name) + if mt.doStringFunc(name) { + continue + } + if mt.doIntFunc(name) { + continue + } + if mt.doTimeFunc(name) { + continue + } + if mt.doButtonFunc(name) { + continue + } + } +} +*/ diff --git a/gitTag.proto b/gitTag.proto index 8c84f2b..e719b76 100644 --- a/gitTag.proto +++ b/gitTag.proto @@ -33,7 +33,7 @@ message GitTag { // `autogenpb:nomutex` string subject = 5; // git tag subject } -message GitTags { // `autogenpb:marshal` `autogenpb:nomutex` +message GitTags { // `autogenpb:marshal` `autogenpb:nomutex` `autogenpb:gui` string uuid = 1; // `autogenpb:uuid:ffdff813-0316-4372-9e82-4c1c7d202526` string version = 2; // `autogenpb:version:v0.0.47` repeated GitTag gitTags = 3; diff --git a/reloadTags.go b/reloadTags.go index ce25b0c..3665567 100644 --- a/reloadTags.go +++ b/reloadTags.go @@ -168,11 +168,16 @@ func (repo *Repo) NewestTag() *GitTag { } // this should just do is.Exists(".git/refs/heads/findname") +// this is a simple check and doesn't work all the time func (repo *Repo) LocalTagExists(findname string) bool { fname := filepath.Join(".git/refs/heads", findname) if repo.Exists(fname) { return true } + fname = filepath.Join(".git/refs/tags", findname) + if repo.Exists(fname) { + return true + } /* loop := repo.Tags.SortByRefname() for loop.Scan() {