MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / loadProjectDiffStats

Function loadProjectDiffStats

desktop/project-git/commit-context.ts:209–234  ·  view source on GitHub ↗
(
  projectId: string,
  baseline?: ProjectDiffBaseline | null,
)

Source from the content-addressed store, hash-verified

207}
208
209export 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}

Callers

nothing calls this directly

Calls 4

isGitRepositoryFunction · 0.90
loadWorktreeStatsFunction · 0.90
formatGitCommandErrorFunction · 0.90

Tested by

no test coverage detected