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

Function isGitRepo

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

Source from the content-addressed store, hash-verified

39 * isn't installed or the path isn't a repo.
40 */
41export function isGitRepo(projectRoot: string): boolean {
42 try {
43 const out = execFileSync('git', ['rev-parse', '--is-inside-work-tree'], {
44 cwd: projectRoot,
45 encoding: 'utf8',
46 stdio: ['ignore', 'pipe', 'ignore'],
47 windowsHide: true,
48 timeout: 5000, // fail fast instead of hanging init/sync on a stuck git (#1139)
49 }).trim();
50 return out === 'true';
51 } catch {
52 return false;
53 }
54}
55
56/**
57 * 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