chore: resolve conflict

This commit is contained in:
Jason Song 2022-12-02 11:17:41 +08:00
parent 9bd773eb85
commit f869c988a5
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5

View File

@ -40,15 +40,17 @@ func SanitizeRefPattern(name string) string {
return refNamePatternInvalid.ReplaceAllString(name, "_") return refNamePatternInvalid.ReplaceAllString(name, "_")
} }
// RefName represents a git reference name // Reference represents a Git ref.
type RefName string type Reference struct {
Name string
func (ref RefName) IsBranch() bool { repo *Repository
return strings.HasPrefix(string(ref), BranchPrefix) Object SHA1 // The id of this commit object
Type string
} }
func (ref RefName) IsTag() bool { // Commit return the commit of the reference
return strings.HasPrefix(string(ref), TagPrefix) func (ref *Reference) Commit() (*Commit, error) {
return ref.repo.getCommit(ref.Object)
} }
// ShortName returns the short name of the reference // ShortName returns the short name of the reference
@ -108,26 +110,3 @@ func (ref RefName) RefGroup() string {
} }
return "" 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()
}