(projectPath: string)
| 118 | * @param projectPath - Path to check (should be already validated/normalized) |
| 119 | */ |
| 120 | export async function isInsideGitRepository(projectPath: string): Promise<boolean> { |
| 121 | try { |
| 122 | using proc = execFileAsync("git", ["-C", projectPath, "rev-parse", "--is-inside-work-tree"]); |
| 123 | const { stdout } = await proc.result; |
| 124 | return stdout.trim() === "true"; |
| 125 | } catch { |
| 126 | return false; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Check whether `filePath` is equal to or nested inside `dirPath`. |
no test coverage detected