From 6cfa6622f31953bd75bfae4c9b10915e3dd6bd78 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Fri, 22 Sep 2023 12:39:00 -0600 Subject: Go documentation for all public functions --- refs.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'refs.go') 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:] -- cgit v1.2.3