From 5a297e4619b9f87844fad07db3496dcd403b7838 Mon Sep 17 00:00:00 2001 From: Jimmy Praet Date: Sun, 22 Nov 2020 21:44:42 +0100 Subject: [PATCH] Use chronological commit order in default squash message (#13661) --- services/pull/pull.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/pull/pull.go b/services/pull/pull.go index 61af7fe9a5df..0bfcd8a63bde 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -556,7 +556,8 @@ func GetCommitMessages(pr *models.PullRequest) string { authorsMap := map[string]bool{} authors := make([]string, 0, list.Len()) stringBuilder := strings.Builder{} - element := list.Front() + // commits list is in reverse chronological order + element := list.Back() for element != nil { commit := element.Value.(*git.Commit) @@ -581,7 +582,7 @@ func GetCommitMessages(pr *models.PullRequest) string { authors = append(authors, authorString) authorsMap[authorString] = true } - element = element.Next() + element = element.Prev() } // Consider collecting the remaining authors