( git: SimpleGit, files: ChangedFile[], diffArgs: string[], )
| 3 | import { parseDiffNumstat } from "./parse-status"; |
| 4 | |
| 5 | export async function applyNumstatToFiles( |
| 6 | git: SimpleGit, |
| 7 | files: ChangedFile[], |
| 8 | diffArgs: string[], |
| 9 | ): Promise<void> { |
| 10 | if (files.length === 0) return; |
| 11 | |
| 12 | try { |
| 13 | const numstat = await git.raw(diffArgs); |
| 14 | const stats = parseDiffNumstat(numstat); |
| 15 | |
| 16 | for (const file of files) { |
| 17 | const fileStat = stats.get(file.path); |
| 18 | if (fileStat) { |
| 19 | file.additions = fileStat.additions; |
| 20 | file.deletions = fileStat.deletions; |
| 21 | } |
| 22 | } |
| 23 | } catch {} |
| 24 | } |
no test coverage detected