diff options
Diffstat (limited to 'refs.go')
-rw-r--r-- | refs.go | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2,6 +2,7 @@ package syw import "strings" +// Ref is an object representing a commit in a repository. type Ref struct { Repo *Repository Name string @@ -11,6 +12,7 @@ type Ref struct { func (r Ref) IsBranch() bool { return strings.HasPrefix(r.Name, "refs/heads/") } func (r Ref) IsTag() bool { return strings.HasPrefix(r.Name, "refs/tags/") } +// ShortName returns the branch or tag name with "refs/[heads|tags]/" trimmed off. func (r Ref) ShortName() string { if r.IsBranch() { return r.Name[11:] |