summaryrefslogtreecommitdiff
path: root/gitTag.common.go
diff options
context:
space:
mode:
Diffstat (limited to 'gitTag.common.go')
-rw-r--r--gitTag.common.go24
1 files changed, 6 insertions, 18 deletions
diff --git a/gitTag.common.go b/gitTag.common.go
index c41f7c1..f10548e 100644
--- a/gitTag.common.go
+++ b/gitTag.common.go
@@ -10,9 +10,7 @@ import (
func (repo *Repo) DevelHash() string {
brname := repo.GetDevelBranchName()
refname := "refs/heads/" + brname
- all := repo.Tags.All()
- for all.Scan() {
- tag := all.Next()
+ for tag := range repo.Tags.IterAll() {
// log.Info("repo tag", tag.GetHash(), tag.GetRefname())
if tag.GetRefname() == refname {
return tag.GetHash()
@@ -23,9 +21,7 @@ func (repo *Repo) DevelHash() string {
func (repo *Repo) GetLocalHash(brname string) string {
refname := "refs/heads/" + brname
- all := repo.Tags.All()
- for all.Scan() {
- tag := all.Next()
+ for tag := range repo.Tags.IterAll() {
// log.Info("repo tag", tag.GetHash(), tag.GetRefname())
if tag.GetRefname() == refname {
return strings.TrimSpace(tag.GetHash())
@@ -36,9 +32,7 @@ func (repo *Repo) GetLocalHash(brname string) string {
func (repo *Repo) GetRemoteHash(brname string) string {
refname := "refs/remotes/origin/" + brname
- all := repo.Tags.All()
- for all.Scan() {
- tag := all.Next()
+ for tag := range repo.Tags.IterAll() {
// log.Info("repo tag", tag.GetHash(), tag.GetRefname())
if tag.GetRefname() == refname {
return strings.TrimSpace(tag.GetHash())
@@ -88,9 +82,7 @@ func (repo *Repo) IsDevelRemote() bool {
// matter much here yet
// 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 {
- loop := repo.Tags.All()
- for loop.Scan() {
- t := loop.Next()
+ for t := range repo.Tags.IterAll() {
// log.Info("LocalTagExists() tag:", t.Refname)
tagname := t.Refname
@@ -109,9 +101,7 @@ func (repo *Repo) IsBranch(findname string) bool {
}
func (repo *Repo) IsLocalBranch(findname string) bool {
- loop := repo.Tags.All()
- for loop.Scan() {
- t := loop.Next()
+ for t := range repo.Tags.IterAll() {
if !strings.HasPrefix(t.Refname, "refs/heads") {
// log.Info("LocalTagExists() skip tag:", t.Refname)
continue
@@ -131,9 +121,7 @@ func (repo *Repo) IsLocalBranch(findname string) bool {
// finds the newest tag. used for deciding if master needs to be published
func (repo *Repo) FindLastTag() string {
var newest *GitTag
- all := repo.Tags.All()
- for all.Scan() {
- tag := all.Next()
+ for tag := range repo.Tags.IterAll() {
if !strings.HasPrefix(tag.GetRefname(), "refs/tags/") {
continue
}