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

Function gitHooksDir

src/sync/git-hooks.ts:60–74  ·  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

58 * and git worktrees. Returns an absolute path, or null when not a repo.
59 */
60function gitHooksDir(projectRoot: string): string | null {
61 try {
62 const out = execFileSync('git', ['rev-parse', '--git-path', 'hooks'], {
63 cwd: projectRoot,
64 encoding: 'utf8',
65 stdio: ['ignore', 'pipe', 'ignore'],
66 windowsHide: true,
67 timeout: 5000, // same rationale as isGitRepo
68 }).trim();
69 if (!out) return null;
70 return path.isAbsolute(out) ? out : path.resolve(projectRoot, out);
71 } catch {
72 return null;
73 }
74}
75
76/** The shell snippet (between markers) injected into each hook. */
77function markerBlock(): string {

Callers 3

installGitSyncHookFunction · 0.85
removeGitSyncHookFunction · 0.85
isSyncHookInstalledFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected