MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / gitHooksDir

Function gitHooksDir

src/sync/git-hooks.ts:73–87  ·  view source on GitHub ↗

* Resolve the git hooks directory for a project, honoring `core.hooksPath` * and git worktrees. Returns an absolute path, or null when not a repo.

(projectRoot: string)

Source from the content-addressed store, hash-verified

71 * and git worktrees. Returns an absolute path, or null when not a repo.
72 */
73function gitHooksDir(projectRoot: string): string | null {
74 try {
75 const out = execFileSync('git', ['rev-parse', '--git-path', 'hooks'], {
76 cwd: projectRoot,
77 encoding: 'utf8',
78 stdio: ['ignore', 'pipe', 'ignore'],
79 windowsHide: true,
80 timeout: 5000, // same rationale as isGitRepo
81 }).trim();
82 if (!out) return null;
83 return path.isAbsolute(out) ? out : path.resolve(projectRoot, out);
84 } catch {
85 return null;
86 }
87}
88
89/**
90 * The key a block records for its project: the resolved root with forward

Callers 3

installGitSyncHookFunction · 0.85
removeGitSyncHookFunction · 0.85
isSyncHookInstalledFunction · 0.85

Calls 1

resolveMethod · 0.65

Tested by

no test coverage detected