Skip to content

Commit 3687160

Browse files
Copilotalexr00
andcommitted
Refine code based on additional review feedback
- Place hyphen at end of character class for clarity - Extract hasBody condition to avoid duplication Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 1325562 commit 3687160

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/github/folderRepositoryManager.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,7 +2895,7 @@ function unwrapCommitMessageBody(body: string): string {
28952895
// - Lines starting with whitespace (indented/code blocks)
28962896
// - Lines starting with list markers (*, -, +, >)
28972897
// - Lines starting with numbered list items (e.g., "1. ")
2898-
const PRESERVE_LINE_PATTERN = /^[ \t*\-+>]|^\d+\./;
2898+
const PRESERVE_LINE_PATTERN = /^[ \t*+>\-]|^\d+\./;
28992899

29002900
const lines = body.split('\n');
29012901
const result: string[] = [];
@@ -2956,9 +2956,10 @@ export const titleAndBodyFrom = async (promise: Promise<string | undefined>): Pr
29562956
return;
29572957
}
29582958
const idxLineBreak = message.indexOf('\n');
2959-
const rawBody = idxLineBreak === -1 ? '' : message.slice(idxLineBreak + 1).trim();
2959+
const hasBody = idxLineBreak !== -1;
2960+
const rawBody = hasBody ? message.slice(idxLineBreak + 1).trim() : '';
29602961
return {
2961-
title: idxLineBreak === -1 ? message : message.slice(0, idxLineBreak),
2962+
title: hasBody ? message.slice(0, idxLineBreak) : message,
29622963

29632964
body: unwrapCommitMessageBody(rawBody),
29642965
};

0 commit comments

Comments
 (0)