tag handling is still bad
This commit is contained in:
parent
62e5fc396c
commit
6654dbb410
|
@ -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}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue