for forge

This commit is contained in:
Jeff Carr 2025-02-21 10:21:25 -06:00
parent 27c8c38047
commit 2204624369
1 changed files with 26 additions and 0 deletions

View File

@ -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 {