MCPcopy Create free account
hub / github.com/freecodexyz/free-code / isAtGitRoot

Function isAtGitRoot

src/utils/git.ts:235–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233}
234
235export async function isAtGitRoot(): Promise<boolean> {
236 const cwd = getCwd()
237 const gitRoot = findGitRoot(cwd)
238 if (!gitRoot) {
239 return false
240 }
241 // Resolve symlinks for accurate comparison
242 try {
243 const [resolvedCwd, resolvedGitRoot] = await Promise.all([
244 realpath(cwd),
245 realpath(gitRoot),
246 ])
247 return resolvedCwd === resolvedGitRoot
248 } catch {
249 return cwd === gitRoot
250 }
251}
252
253export const dirIsInGitRepo = async (cwd: string): Promise<boolean> => {
254 return findGitRoot(cwd) !== null

Callers

nothing calls this directly

Calls 1

getCwdFunction · 0.85

Tested by

no test coverage detected