for forge
This commit is contained in:
parent
27c8c38047
commit
2204624369
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue