(arg: string)
| 158 | * `hooks/`, `refs/` etc. — those are common project directory names. |
| 159 | */ |
| 160 | export function isDotGitPathPS(arg: string): boolean { |
| 161 | const n = resolveCwdReentry(normalizeGitPathArg(arg)) |
| 162 | if (matchesDotGitPrefix(n)) return true |
| 163 | // SECURITY: same cwd-resolution as isGitInternalPathPS — catch |
| 164 | // `..\<cwd-basename>\.git\hooks\pre-commit` that lands back in cwd. |
| 165 | if (n.startsWith('../') || n.startsWith('/') || /^[a-z]:/.test(n)) { |
| 166 | const rel = resolveEscapingPathToCwdRelative(n) |
| 167 | if (rel !== null && matchesDotGitPrefix(rel)) return true |
| 168 | } |
| 169 | return false |
| 170 | } |
| 171 | |
| 172 | function matchesDotGitPrefix(n: string): boolean { |
| 173 | if (n === '.git' || n.startsWith('.git/')) return true |
no test coverage detected