File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -517,7 +517,7 @@ func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error {
517
517
return nil
518
518
}
519
519
520
- var commitMessageTrailersPattern = regexp .MustCompile (`(^|.* \n\n)([\w-]+: [^\n]+)(\n[\w-]+: [^\n]+)* $` )
520
+ var commitMessageTrailersPattern = regexp .MustCompile (`(?:^| \n\n)(?: [\w-]+: [^\n]+\n*)+ $` )
521
521
522
522
// GetSquashMergeCommitMessages returns the commit messages between head and merge base (if there is one)
523
523
func GetSquashMergeCommitMessages (pr * models.PullRequest ) string {
@@ -574,12 +574,13 @@ func GetSquashMergeCommitMessages(pr *models.PullRequest) string {
574
574
stringBuilder := strings.Builder {}
575
575
576
576
if ! setting .Repository .PullRequest .PopulateSquashCommentWithCommitMessages {
577
- stringBuilder .WriteString (pr .Issue .Content )
577
+ message := strings .TrimSpace (pr .Issue .Content )
578
+ stringBuilder .WriteString (message )
578
579
if stringBuilder .Len () > 0 {
579
580
stringBuilder .WriteRune ('\n' )
580
- if ! commitMessageTrailersPattern .MatchString (pr . Issue . Content ) {
581
- stringBuilder .WriteRune ('\n' )
582
- }
581
+ if ! commitMessageTrailersPattern .MatchString (message ) {
582
+ stringBuilder .WriteRune ('\n' )
583
+ }
583
584
}
584
585
}
585
586
You can’t perform that action at this time.
0 commit comments