MCPcopy Index your code
hub / github.com/continuedev/continue / getGitDiffSnapshot

Function getGitDiffSnapshot

extensions/cli/src/util/git.ts:133–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131}
132
133export async function getGitDiffSnapshot(): Promise<GitDiffSnapshot> {
134 try {
135 await execAsync("git rev-parse --git-dir", {
136 maxBuffer: LARGE_STDIO_BUFFER_BYTES,
137 });
138 } catch (error) {
139 if (isExecError(error) && error.code === 128) {
140 return { diff: "", repoFound: false };
141 }
142 throw error;
143 }
144
145 try {
146 const { stdout } = await execAsync("git diff main", {
147 maxBuffer: LARGE_STDIO_BUFFER_BYTES,
148 });
149 return { diff: stdout, repoFound: true };
150 } catch (error) {
151 if (isExecError(error)) {
152 if (error.code === 1 && error.stdout) {
153 return { diff: error.stdout, repoFound: true };
154 }
155
156 if (error.code === 128) {
157 return { diff: "", repoFound: false };
158 }
159 }
160 throw error;
161 }
162}

Callers 3

serveFunction · 0.85
performUploadMethod · 0.85
collectDiffStatsFunction · 0.85

Calls 1

isExecErrorFunction · 0.85

Tested by

no test coverage detected