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

Function loadProjectDiff

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

Source from the content-addressed store, hash-verified

179}
180
181export async function loadProjectDiff(
182 projectId: string,
183 baseline?: ProjectDiffBaseline | null,
184): Promise<ProjectDiffResult | null> {
185 if (!(await isGitRepository(projectId))) {
186 return null
187 }
188
189 try {
190 const resolvedBaseline = await resolveProjectDiffBaseline(projectId, baseline)
191 const snapshot = await loadWorktreeSnapshot(projectId, {
192 baselineRev: resolvedBaseline.rev,
193 })
194
195 return {
196 projectId,
197 diff: snapshot.patch,
198 fileCount: snapshot.fileCount,
199 insertions: snapshot.insertions,
200 deletions: snapshot.deletions,
201 baseline: baseline ?? { kind: 'head' },
202 resolvedBaseline,
203 }
204 } catch (error) {
205 throw new Error(`Could not load worktree diff: ${formatGitCommandError(error)}`)
206 }
207}
208
209export async function loadProjectDiffStats(
210 projectId: string,

Callers

nothing calls this directly

Calls 4

isGitRepositoryFunction · 0.90
loadWorktreeSnapshotFunction · 0.90
formatGitCommandErrorFunction · 0.90

Tested by

no test coverage detected