(dir: string)
| 30 | * is exactly the distinction this module relies on. |
| 31 | */ |
| 32 | export function gitWorktreeRoot(dir: string): string | null { |
| 33 | try { |
| 34 | const out = execFileSync('git', ['rev-parse', '--show-toplevel'], { |
| 35 | cwd: dir, |
| 36 | encoding: 'utf8', |
| 37 | stdio: ['ignore', 'pipe', 'ignore'], |
| 38 | windowsHide: true, |
| 39 | }).trim(); |
| 40 | return out ? realpath(out) : null; |
| 41 | } catch { |
| 42 | return null; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Absolute, symlink-resolved git **common** directory for `dir` — the shared |
no test coverage detected