| 429 | } |
| 430 | |
| 431 | function parseCustomCommitMessage(raw: string): { subject: string; body: string } | null { |
| 432 | const normalized = raw.replace(/\r\n/g, "\n").trim(); |
| 433 | if (normalized.length === 0) { |
| 434 | return null; |
| 435 | } |
| 436 | |
| 437 | const [firstLine, ...rest] = normalized.split("\n"); |
| 438 | const subject = firstLine?.trim() ?? ""; |
| 439 | if (subject.length === 0) { |
| 440 | return null; |
| 441 | } |
| 442 | |
| 443 | return { |
| 444 | subject, |
| 445 | body: rest.join("\n").trim(), |
| 446 | }; |
| 447 | } |
| 448 | |
| 449 | function appendUnique(values: string[], next: string | null | undefined): void { |
| 450 | const trimmed = next?.trim() ?? ""; |