(projectRoot: string)
| 52 | * isn't installed or the path isn't a repo. |
| 53 | */ |
| 54 | export 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` |
no outgoing calls
no test coverage detected