aboutsummaryrefslogtreecommitdiff
path: root/models/action.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/models/action.go b/models/action.go
index 2e158cbf..e38cf593 100644
--- a/models/action.go
+++ b/models/action.go
@@ -189,7 +189,10 @@ func issueIndexTrimRight(c rune) bool {
// updateIssuesCommit checks if issues are manipulated by commit message.
func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string, commits []*base.PushCommit) error {
- for _, c := range commits {
+ // Commits are appended in the reverse order.
+ for i := len(commits) - 1; i >= 0; i-- {
+ c := commits[i]
+
refMarked := make(map[int64]bool)
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
@@ -210,6 +213,9 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
issue, err := GetIssueByRef(ref)
if err != nil {
+ if IsErrIssueNotExist(err) {
+ continue
+ }
return err
}
@@ -246,6 +252,9 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
issue, err := GetIssueByRef(ref)
if err != nil {
+ if IsErrIssueNotExist(err) {
+ continue
+ }
return err
}
@@ -283,6 +292,9 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
issue, err := GetIssueByRef(ref)
if err != nil {
+ if IsErrIssueNotExist(err) {
+ continue
+ }
return err
}
@@ -346,10 +358,14 @@ func CommitRepoAction(
}
if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
- log.Debug("updateIssuesCommit: %v", err)
+ log.Error(4, "updateIssuesCommit: %v", err)
}
}
+ if len(commit.Commits) > setting.FeedMaxCommitNum {
+ commit.Commits = commit.Commits[:setting.FeedMaxCommitNum]
+ }
+
bs, err := json.Marshal(commit)
if err != nil {
return fmt.Errorf("Marshal: %v", err)