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

Function getDiffStats

desktop/project-git/project-state.ts:140–153  ·  view source on GitHub ↗
(projectId: string)

Source from the content-addressed store, hash-verified

138}
139
140async function getDiffStats(projectId: string) {
141 try {
142 const args = (await hasHeadCommit(projectId))
143 ? ['diff', '--shortstat', 'HEAD', '--']
144 : ['diff', '--cached', '--shortstat', '--root', '--']
145 const { stdout } = await runGitWithOptions(projectId, args, {
146 timeout: 10_000,
147 maxBuffer: 1024 * 1024 * 4,
148 })
149 return parseShortStat(stdout)
150 } catch {
151 return { insertions: 0, deletions: 0 }
152 }
153}
154
155export async function loadProjectGitState(projectId: string): Promise<ProjectGitState> {
156 const gitOpsModeOverride = getProjectGitOpsModeOverride(projectId)

Callers 1

loadProjectGitStateFunction · 0.85

Calls 3

hasHeadCommitFunction · 0.90
runGitWithOptionsFunction · 0.90
parseShortStatFunction · 0.70

Tested by

no test coverage detected