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