Download apps/server/dist/lib/git-log-parser.js from Leon4gr45/automaker: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/apps/server/dist/lib/git-log-parser.js
- Command line
-
hf download hf://spaces/Leon4gr45/automaker/apps/server/dist/lib/git-log-parser.js
-
curl -L -o git-log-parser.js https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/apps/server/dist/lib/git-log-parser.js
1.6 kB
| export function parseGitLogOutput(output) { | |
| const commits = []; | |
| // Split by NUL character to separate commits | |
| const commitBlocks = output.split('\0').filter((block) => block.trim()); | |
| for (const block of commitBlocks) { | |
| const allLines = block.split('\n'); | |
| // Skip leading empty lines that may appear at block boundaries | |
| let startIndex = 0; | |
| while (startIndex < allLines.length && allLines[startIndex].trim() === '') { | |
| startIndex++; | |
| } | |
| const fields = allLines.slice(startIndex); | |
| // Validate we have all expected fields (at least hash, shortHash, author, authorEmail, date, subject) | |
| if (fields.length < 6) { | |
| continue; // Skip malformed blocks | |
| } | |
| const commit = { | |
| hash: fields[0].trim(), | |
| shortHash: fields[1].trim(), | |
| author: fields[2].trim(), | |
| authorEmail: fields[3].trim(), | |
| date: fields[4].trim(), | |
| subject: fields[5].trim(), | |
| body: fields.slice(6).join('\n').trim(), | |
| }; | |
| commits.push(commit); | |
| } | |
| return commits; | |
| } | |
| /** | |
| * Creates a commit object from parsed fields, matching the expected API response format | |
| */ | |
| export function createCommitFromFields(fields, files) { | |
| return { | |
| hash: fields.hash, | |
| shortHash: fields.shortHash, | |
| author: fields.author, | |
| authorEmail: fields.authorEmail, | |
| date: fields.date, | |
| subject: fields.subject, | |
| body: fields.body, | |
| files: files || [], | |
| }; | |
| } | |
| //# sourceMappingURL=git-log-parser.js.map |