diff options
author | Unknwon <u@gogs.io> | 2015-09-25 20:35:56 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-25 20:35:56 -0400 |
commit | 6dfee30bf0a6faef3211eb9fd1587c4fd8e87eef (patch) | |
tree | 0200056e4ad2bc5f7de3840429c17265ff0b0ce7 /models/action.go | |
parent | 21e13cb51e73471d186b963e26404f89abd81fce (diff) | |
download | gitea-6dfee30bf0a6faef3211eb9fd1587c4fd8e87eef.tar.gz gitea-6dfee30bf0a6faef3211eb9fd1587c4fd8e87eef.zip |
#1602 Wrong commit order on issue page when pushing multiple commits
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/models/action.go b/models/action.go index 2e158cbf16..07e4da8f95 100644 --- a/models/action.go +++ b/models/action.go @@ -189,7 +189,11 @@ 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] + fmt.Println(c) + refMarked := make(map[int64]bool) for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) { ref = ref[strings.IndexByte(ref, byte(' '))+1:] @@ -350,6 +354,10 @@ func CommitRepoAction( } } + 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) |