MCPcopy Index your code
hub / github.com/codeaashu/claude-code / fetchGitDiffHunks

Function fetchGitDiffHunks

src/utils/gitDiff.ts:114–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112 * Separated from fetchGitDiff() to avoid expensive calls during polling.
113 */
114export 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
137export type NumstatResult = {
138 stats: GitDiffStats

Callers 1

loadDiffDataFunction · 0.85

Calls 3

isInTransientGitStateFunction · 0.85
execFileNoThrowFunction · 0.85
parseGitDiffFunction · 0.85

Tested by

no test coverage detected