(output: string)
| 38 | } |
| 39 | |
| 40 | function parseCommitEntries(output: string) { |
| 41 | return output |
| 42 | .replace(trailingLineBreakPattern, '') |
| 43 | .split(FIELD_SEPARATOR) |
| 44 | .reduce<string[][]>((records, field, index) => { |
| 45 | const recordIndex = Math.floor(index / COMMIT_FIELD_COUNT) |
| 46 | const currentRecord = records[recordIndex] ?? [] |
| 47 | currentRecord.push(field) |
| 48 | records[recordIndex] = currentRecord |
| 49 | return records |
| 50 | }, []) |
| 51 | .filter((fields) => fields.length >= COMMIT_FIELD_COUNT) |
| 52 | .map((fields) => parseCommitEntry(fields.slice(0, COMMIT_FIELD_COUNT))) |
| 53 | .filter((record): record is ProjectCommitEntry => record !== null) |
| 54 | } |
| 55 | |
| 56 | export async function resolveCommitRevision( |
| 57 | projectId: string, |
no test coverage detected