MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isAtGitRoot

Function isAtGitRoot

source code/utils/git.ts:237–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

getCwdFunction · 0.85

Tested by

no test coverage detected