From f869c988a58ac5d6b8883c4774fb6493fec62557 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 2 Dec 2022 11:17:41 +0800 Subject: [PATCH] chore: resolve conflict --- modules/git/ref.go | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/modules/git/ref.go b/modules/git/ref.go index 21911cab4c..47cc04b7fb 100644 --- a/modules/git/ref.go +++ b/modules/git/ref.go @@ -40,15 +40,17 @@ func SanitizeRefPattern(name string) string { return refNamePatternInvalid.ReplaceAllString(name, "_") } -// RefName represents a git reference name -type RefName string - -func (ref RefName) IsBranch() bool { - return strings.HasPrefix(string(ref), BranchPrefix) +// Reference represents a Git ref. +type Reference struct { + Name string + repo *Repository + Object SHA1 // The id of this commit object + Type string } -func (ref RefName) IsTag() bool { - return strings.HasPrefix(string(ref), TagPrefix) +// Commit return the commit of the reference +func (ref *Reference) Commit() (*Commit, error) { + return ref.repo.getCommit(ref.Object) } // ShortName returns the short name of the reference @@ -108,26 +110,3 @@ func (ref RefName) RefGroup() string { } return "" } - -// Reference represents a Git ref. -type Reference struct { - Name string - repo *Repository - Object SHA1 // The id of this commit object - Type string -} - -// Commit return the commit of the reference -func (ref *Reference) Commit() (*Commit, error) { - return ref.repo.getCommit(ref.Object) -} - -// ShortName returns the short name of the reference name -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() -}