Merge branch 'main' into feature/bots

This commit is contained in:
Jason Song
2022-12-02 09:42:42 +08:00
committed by GitHub
5 changed files with 33 additions and 6 deletions

View File

@ -51,6 +51,27 @@ func (ref RefName) IsTag() bool {
return strings.HasPrefix(string(ref), TagPrefix)
}
// ShortName returns the short name of the reference
func (ref *Reference) ShortName() string {
return RefName(ref.Name).ShortName()
}
// RefGroup returns the group type of the reference
func (ref *Reference) RefGroup() string {
return RefName(ref.Name).RefGroup()
}
// RefName represents a git reference name
type RefName string
func (ref RefName) IsBranch() bool {
return strings.HasPrefix(string(ref), BranchPrefix)
}
func (ref RefName) IsTag() bool {
return strings.HasPrefix(string(ref), TagPrefix)
}
// ShortName returns the short name of the reference name
func (ref RefName) ShortName() string {
refName := string(ref)