File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -860,13 +860,18 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
860860 continue
861861 }
862862
863+ // This format follows GitHub's squash commit message style,
864+ // even if there are other "* " in the commit message body, they are written as-is.
865+ // Maybe, ideally, we should indent those lines too.
863866 _ , _ = fmt .Fprintf (& stringBuilder , "* %s\n \n " , msg )
864867 if maxMsgSize > 0 && stringBuilder .Len () >= maxMsgSize {
865868 tmp := stringBuilder .String ()
866869 wasValidUtf8 := utf8 .ValidString (tmp )
867870 tmp = tmp [:maxMsgSize ] + "..."
868871 if wasValidUtf8 {
869- tmp = strings .ToValidUTF8 (tmp , "?" )
872+ // If the message was valid UTF-8 before truncation, ensure it remains valid after truncation
873+ // For non-utf8 messages, we can't do much about it, end users should use utf-8 as much as possible
874+ tmp = strings .ToValidUTF8 (tmp , "" )
870875 }
871876 stringBuilder .Reset ()
872877 stringBuilder .WriteString (tmp )
You can’t perform that action at this time.
0 commit comments