MCPcopy Index your code
hub / github.com/Waishnav/devspace / git

Function git

src/git-worktrees.ts:162–181  ·  view source on GitHub ↗
(args: string[], cwd: string)

Source from the content-addressed store, hash-verified

160}
161
162async function git(args: string[], cwd: string): Promise<string> {
163 try {
164 const { stdout } = await execFileAsync("git", args, {
165 cwd,
166 maxBuffer: 10 * 1024 * 1024,
167 });
168 return stdout;
169 } catch (error) {
170 if (isGitUnavailable(error)) throw error;
171
172 const stderr = typeof error === "object" && error && "stderr" in error
173 ? String((error as { stderr?: unknown }).stderr ?? "").trim()
174 : "";
175 const stdout = typeof error === "object" && error && "stdout" in error
176 ? String((error as { stdout?: unknown }).stdout ?? "").trim()
177 : "";
178 const details = stderr || stdout || (error instanceof Error ? error.message : String(error));
179 throw new Error(details);
180 }
181}
182
183function isGitUnavailable(error: unknown): boolean {
184 return Boolean(

Callers 3

createManagedWorktreeFunction · 0.70
resolveGitRootFunction · 0.70
resolveBaseCommitFunction · 0.70

Calls 1

isGitUnavailableFunction · 0.85

Tested by

no test coverage detected