Skip to content

Commit e362d18

Browse files
committed
comment
1 parent 3bf6396 commit e362d18

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

services/pull/pull.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)