Skip to content

Commit

Permalink
fix(app/Commands): fix CommitCommand message parsing
Browse files Browse the repository at this point in the history
- Update message parsing logic in CommitCommand
- Trim leading and trailing whitespace
- Remove control characters from the message
  • Loading branch information
ityaozm@gmail.com committed Oct 22, 2024
1 parent 705b0d9 commit 790602d
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 80 deletions.
1 change: 1 addition & 0 deletions app/Commands/CommitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ private function tryFixMessage(string $message): string
// '/,\s*,/' => ',', // 连续的逗号
// '/[\x00-\x1F\x7F-\x9F]/mu' => '', // 控制字符
'/[[:cntrl:]]/mu' => '', // 控制字符
'/\s+/' => ' ', // 连续的空格
])->reduce(static function (Stringable $message, string $replace, string $pattern): Stringable {
return $message->replaceMatches($pattern, $replace);
}, $message);
Expand Down
Loading

0 comments on commit 790602d

Please sign in to comment.