(stdout: string)
| 369 | * loading all content. Used as a quick probe before expensive operations. |
| 370 | */ |
| 371 | export function parseShortstat(stdout: string): GitDiffStats | null { |
| 372 | // Match: "N files changed" with optional ", N insertions(+)" and ", N deletions(-)" |
| 373 | const match = stdout.match( |
| 374 | /(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/, |
| 375 | ) |
| 376 | if (!match) return null |
| 377 | return { |
| 378 | filesCount: parseInt(match[1] ?? '0', 10), |
| 379 | linesAdded: parseInt(match[2] ?? '0', 10), |
| 380 | linesRemoved: parseInt(match[3] ?? '0', 10), |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | const SINGLE_FILE_DIFF_TIMEOUT_MS = 3000 |
| 385 |
no outgoing calls
no test coverage detected