()
| 112 | * Separated from fetchGitDiff() to avoid expensive calls during polling. |
| 113 | */ |
| 114 | export async function fetchGitDiffHunks(): Promise< |
| 115 | Map<string, StructuredPatchHunk[]> |
| 116 | > { |
| 117 | const isGit = await getIsGit() |
| 118 | if (!isGit) return new Map() |
| 119 | |
| 120 | if (await isInTransientGitState()) { |
| 121 | return new Map() |
| 122 | } |
| 123 | |
| 124 | const { stdout: diffOut, code: diffCode } = await execFileNoThrow( |
| 125 | gitExe(), |
| 126 | ['--no-optional-locks', 'diff', 'HEAD'], |
| 127 | { timeout: GIT_TIMEOUT_MS, preserveOutputOnError: false }, |
| 128 | ) |
| 129 | |
| 130 | if (diffCode !== 0) { |
| 131 | return new Map() |
| 132 | } |
| 133 | |
| 134 | return parseGitDiff(diffOut) |
| 135 | } |
| 136 | |
| 137 | export type NumstatResult = { |
| 138 | stats: GitDiffStats |
no test coverage detected