1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

#1602 Wrong commit order on issue page when pushing multiple commits

This commit is contained in:
Unknwon
2015-09-25 20:35:56 -04:00
parent 21e13cb51e
commit 6dfee30bf0
9 changed files with 29 additions and 27 deletions

View File

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