summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-12-02 18:20:12 -0800
committerLunny Xiao <xiaolunwen@gmail.com>2017-12-03 10:20:12 +0800
commit3163abedd6c3814d04b380c036ca19a7bffe908f (patch)
tree552e8bbdaa2e8b2f2c9326ae935bfdcae67d198b /models/issue.go
parentb0971ae37c255ea219c07489bc66809caa1094ef (diff)
downloadgitea-3163abedd6c3814d04b380c036ca19a7bffe908f.tar.gz
gitea-3163abedd6c3814d04b380c036ca19a7bffe908f.zip
Fix ref parsing in commit messages (#3067)
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/models/issue.go b/models/issue.go
index 00e0bf8027..5f576be4a9 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -5,7 +5,6 @@
package models
import (
- "errors"
"fmt"
"path"
"sort"
@@ -22,11 +21,6 @@ import (
"code.gitea.io/gitea/modules/util"
)
-var (
- errMissingIssueNumber = errors.New("No issue number specified")
- errInvalidIssueNumber = errors.New("Invalid issue number")
-)
-
// Issue represents an issue or pull request of repository.
type Issue struct {
ID int64 `xorm:"pk autoincr"`
@@ -961,32 +955,6 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
return nil
}
-// GetIssueByRef returns an Issue specified by a GFM reference.
-// See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
-func GetIssueByRef(ref string) (*Issue, error) {
- n := strings.IndexByte(ref, '#')
- if n == -1 {
- return nil, errMissingIssueNumber
- }
-
- index, err := com.StrTo(ref[n+1:]).Int64()
- if err != nil {
- return nil, errInvalidIssueNumber
- }
-
- i := strings.IndexByte(ref[:n], '/')
- if i < 2 {
- return nil, ErrInvalidReference
- }
-
- repo, err := GetRepositoryByOwnerAndName(ref[:i], ref[i+1:n])
- if err != nil {
- return nil, err
- }
-
- return GetIssueByIndex(repo.ID, index)
-}
-
// GetRawIssueByIndex returns raw issue without loading attributes by index in a repository.
func GetRawIssueByIndex(repoID, index int64) (*Issue, error) {
issue := &Issue{