( projectId: string, baseline?: ProjectDiffBaseline | null, )
| 207 | } |
| 208 | |
| 209 | export async function loadProjectDiffStats( |
| 210 | projectId: string, |
| 211 | baseline?: ProjectDiffBaseline | null, |
| 212 | ): Promise<ProjectDiffStatsResult | null> { |
| 213 | if (!(await isGitRepository(projectId))) { |
| 214 | return null |
| 215 | } |
| 216 | |
| 217 | try { |
| 218 | const resolvedBaseline = await resolveProjectDiffBaseline(projectId, baseline) |
| 219 | const stats = await loadWorktreeStats(projectId, { |
| 220 | baselineRev: resolvedBaseline.rev, |
| 221 | }) |
| 222 | |
| 223 | return { |
| 224 | projectId, |
| 225 | fileCount: stats.fileCount, |
| 226 | insertions: stats.insertions, |
| 227 | deletions: stats.deletions, |
| 228 | baseline: baseline ?? { kind: 'head' }, |
| 229 | resolvedBaseline, |
| 230 | } |
| 231 | } catch (error) { |
| 232 | throw new Error(`Could not load worktree diff stats: ${formatGitCommandError(error)}`) |
| 233 | } |
| 234 | } |
nothing calls this directly
no test coverage detected