summaryrefslogtreecommitdiff
path: root/refs.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-22 12:39:00 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-22 12:39:00 -0600
commit6cfa6622f31953bd75bfae4c9b10915e3dd6bd78 (patch)
tree71c6d9b9e76ba0abc9ae6031a316f644246461d7 /refs.go
parent1a1832b77d53849a0aa8216627301aaf9e18d6f8 (diff)
Go documentation for all public functions
Diffstat (limited to 'refs.go')
-rw-r--r--refs.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/refs.go b/refs.go
index aec9c91..2b6d1f6 100644
--- a/refs.go
+++ b/refs.go
@@ -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:]