MCPcopy
hub / github.com/coder/mux / isInsideGitRepository

Function isInsideGitRepository

src/node/utils/pathUtils.ts:120–128  ·  view source on GitHub ↗
(projectPath: string)

Source from the content-addressed store, hash-verified

118 * @param projectPath - Path to check (should be already validated/normalized)
119 */
120export async function isInsideGitRepository(projectPath: string): Promise<boolean> {
121 try {
122 using proc = execFileAsync("git", ["-C", projectPath, "rev-parse", "--is-inside-work-tree"]);
123 const { stdout } = await proc.result;
124 return stdout.trim() === "true";
125 } catch {
126 return false;
127 }
128}
129
130/**
131 * Check whether `filePath` is equal to or nested inside `dirPath`.

Callers 2

listBranchesMethod · 0.90
getFileCompletionsMethod · 0.90

Calls 1

execFileAsyncFunction · 0.90

Tested by

no test coverage detected