summaryrefslogtreecommitdiff
path: root/gitTag.common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-21 10:21:25 -0600
committerJeff Carr <[email protected]>2025-02-21 10:21:25 -0600
commit22046243699a4cad639a749410b19ce52211cda8 (patch)
tree3755eec9046bf15c1d1e14eae93114e5e9587c03 /gitTag.common.go
parent27c8c380475147f640fb971fe5ac5d0b5d1b2ac3 (diff)
for forgev0.0.83
Diffstat (limited to 'gitTag.common.go')
-rw-r--r--gitTag.common.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/gitTag.common.go b/gitTag.common.go
index 43c0dbc..81e44c3 100644
--- a/gitTag.common.go
+++ b/gitTag.common.go
@@ -21,6 +21,32 @@ func (repo *Repo) DevelHash() string {
return ""
}
+func (repo *Repo) GetLocalHash(brname string) string {
+ refname := "refs/heads/" + brname
+ all := repo.Tags.All()
+ for all.Scan() {
+ tag := all.Next()
+ // log.Info("repo tag", tag.GetHash(), tag.GetRefname())
+ if tag.GetRefname() == refname {
+ return strings.TrimSpace(tag.GetHash())
+ }
+ }
+ return ""
+}
+
+func (repo *Repo) GetRemoteHash(brname string) string {
+ refname := "refs/remotes/origin/" + brname
+ all := repo.Tags.All()
+ for all.Scan() {
+ tag := all.Next()
+ // log.Info("repo tag", tag.GetHash(), tag.GetRefname())
+ if tag.GetRefname() == refname {
+ return strings.TrimSpace(tag.GetHash())
+ }
+ }
+ return ""
+}
+
// this is the correct way. uses 'git show-ref'
func (repo *Repo) IsBranchRemote(brname string) bool {
if repo.Tags == nil {