From 171b3a73e7ab7015f9eb8e98965e36dfb8ea9599 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Wed, 2 Aug 2017 13:00:31 +0200 Subject: plumbing: moved `Reference.Is*` methods to `ReferenceName.Is*` --- plumbing/reference.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'plumbing/reference.go') diff --git a/plumbing/reference.go b/plumbing/reference.go index 5d477b9..2c30fe0 100644 --- a/plumbing/reference.go +++ b/plumbing/reference.go @@ -55,6 +55,26 @@ func (r ReferenceType) String() string { // ReferenceName reference name's type ReferenceName string +// IsBranch check if a reference is a branch +func (r ReferenceName) IsBranch() bool { + return strings.HasPrefix(string(r), refHeadPrefix) +} + +// IsNote check if a reference is a note +func (r ReferenceName) IsNote() bool { + return strings.HasPrefix(string(r), refNotePrefix) +} + +// IsRemote check if a reference is a remote +func (r ReferenceName) IsRemote() bool { + return strings.HasPrefix(string(r), refRemotePrefix) +} + +// IsTag check if a reference is a tag +func (r ReferenceName) IsTag() bool { + return strings.HasPrefix(string(r), refTagPrefix) +} + func (r ReferenceName) String() string { return string(r) } @@ -138,26 +158,6 @@ func (r *Reference) Target() ReferenceName { return r.target } -// IsBranch check if a reference is a branch -func (r *Reference) IsBranch() bool { - return strings.HasPrefix(string(r.n), refHeadPrefix) -} - -// IsNote check if a reference is a note -func (r *Reference) IsNote() bool { - return strings.HasPrefix(string(r.n), refNotePrefix) -} - -// IsRemote check if a reference is a remote -func (r *Reference) IsRemote() bool { - return strings.HasPrefix(string(r.n), refRemotePrefix) -} - -// IsTag check if a reference is a tag -func (r *Reference) IsTag() bool { - return strings.HasPrefix(string(r.n), refTagPrefix) -} - // Strings dump a reference as a [2]string func (r *Reference) Strings() [2]string { var o [2]string -- cgit