Skip to content

Commit 7fa9e12

Browse files
committed
Fixed multiline commits.
Testing no multiline commit messages.
1 parent 172e38d commit 7fa9e12

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const renderFileAsync = promisify(twig.renderFile);
1818
// Get the three most recent commits
1919
export function getRecentCommits(count = 3) {
2020
try {
21-
const format = '--pretty=format:%h\\|\\|\\|%s\\|\\|\\|%b';
21+
// Use %x00 (null byte) as commit separator to handle multi-line messages
22+
const format = '--pretty=format:%h\\|\\|\\|%s%x00';
2223
const output = execSync(`git log -${count} ${format}`).toString().trim();
2324

24-
return output.split('\n').map(line => {
25-
const [hash, subject, body] = line.split('|||');
25+
return output.split('\x00').filter(Boolean).map(line => {
26+
const [hash, subject] = line.split('|||');
2627
return {
2728
hash,
28-
subject,
29-
body: body ? body.trim() : ''
29+
subject
3030
};
3131
});
3232
} catch (error) {

0 commit comments

Comments
 (0)