Skip to content

Commit 790602d

Browse files
author
ityaozm@gmail.com
committed
fix(app/Commands): fix CommitCommand message parsing
- Update message parsing logic in CommitCommand - Trim leading and trailing whitespace - Remove control characters from the message
1 parent 705b0d9 commit 790602d

File tree

3 files changed

+171
-80
lines changed

3 files changed

+171
-80
lines changed

app/Commands/CommitCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ private function tryFixMessage(string $message): string
354354
// '/,\s*,/' => ',', // 连续的逗号
355355
// '/[\x00-\x1F\x7F-\x9F]/mu' => '', // 控制字符
356356
'/[[:cntrl:]]/mu' => '', // 控制字符
357+
'/\s+/' => ' ', // 连续的空格
357358
])->reduce(static function (Stringable $message, string $replace, string $pattern): Stringable {
358359
return $message->replaceMatches($pattern, $replace);
359360
}, $message);

0 commit comments

Comments
 (0)