1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-26 12:18:36 +00:00

chore: resolve conflict

This commit is contained in:
Jason Song
2022-12-02 11:17:41 +08:00
parent 9bd773eb85
commit f869c988a5

View File

@@ -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()
}