MCPcopy
hub / github.com/colbymchenry/codegraph / gitWorktreeRoot

Function gitWorktreeRoot

src/sync/worktree.ts:32–44  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

30 * is exactly the distinction this module relies on.
31 */
32export function gitWorktreeRoot(dir: string): string | null {
33 try {
34 const out = execFileSync('git', ['rev-parse', '--show-toplevel'], {
35 cwd: dir,
36 encoding: 'utf8',
37 stdio: ['ignore', 'pipe', 'ignore'],
38 windowsHide: true,
39 }).trim();
40 return out ? realpath(out) : null;
41 } catch {
42 return null;
43 }
44}
45
46/**
47 * Absolute, symlink-resolved git **common** directory for `dir` — the shared

Callers 2

Calls 1

realpathFunction · 0.85

Tested by

no test coverage detected