* Parse git diff --numstat output * Format: added\tremoved\tpath
(numstatOutput: string)
| 119 | * Format: added\tremoved\tpath |
| 120 | */ |
| 121 | function parseNumstat(numstatOutput: string): Map<string, NumstatEntry> { |
| 122 | const map = new Map<string, NumstatEntry>(); |
| 123 | |
| 124 | for (const line of numstatOutput.split('\n')) { |
| 125 | if (!line.trim()) { |
| 126 | continue; |
| 127 | } |
| 128 | |
| 129 | const parts = line.split('\t'); |
| 130 | if (parts.length < 3) { |
| 131 | continue; |
| 132 | } |
| 133 | |
| 134 | const added = parts[0] === '-' ? 0 : Number.parseInt(parts[0], 10); |
| 135 | const removed = parts[1] === '-' ? 0 : Number.parseInt(parts[1], 10); |
| 136 | const path = parts[2]; |
| 137 | |
| 138 | map.set(path, { linesAdded: added, linesRemoved: removed }); |
| 139 | } |
| 140 | |
| 141 | return map; |
| 142 | } |
| 143 | |
| 144 | async function discoverChangedFiles( |
| 145 | repoPath: string, |
no test coverage detected
searching dependent graphs…