MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / findGitRoot

Function findGitRoot

cli/src/utils/git.ts:4–17  ·  view source on GitHub ↗
(params: { cwd: string })

Source from the content-addressed store, hash-verified

2import { dirname, join } from 'path'
3
4export function findGitRoot(params: { cwd: string }): string | null {
5 const { cwd } = params
6
7 let currentDir = cwd
8
9 while (currentDir !== dirname(currentDir)) {
10 if (existsSync(join(currentDir, '.git'))) {
11 return currentDir
12 }
13 currentDir = dirname(currentDir)
14 }
15
16 return null
17}

Callers 1

AppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected