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

Function isGitRepo

src/sync/git-hooks.ts:54–67  ·  view source on GitHub ↗
(projectRoot: string)

Source from the content-addressed store, hash-verified

52 * isn't installed or the path isn't a repo.
53 */
54export function isGitRepo(projectRoot: string): boolean {
55 try {
56 const out = execFileSync('git', ['rev-parse', '--is-inside-work-tree'], {
57 cwd: projectRoot,
58 encoding: 'utf8',
59 stdio: ['ignore', 'pipe', 'ignore'],
60 windowsHide: true,
61 timeout: 5000, // fail fast instead of hanging init/sync on a stuck git (#1139)
62 }).trim();
63 return out === 'true';
64 } catch {
65 return false;
66 }
67}
68
69/**
70 * Resolve the git hooks directory for a project, honoring `core.hooksPath`

Callers 3

offerWatchFallbackFunction · 0.90
git-hooks.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected