(arg: string)
| 137 | * (.git/hooks/, .git/config). |
| 138 | */ |
| 139 | export function isGitInternalPathPS(arg: string): boolean { |
| 140 | const n = resolveCwdReentry(normalizeGitPathArg(arg)) |
| 141 | if (matchesGitInternalPrefix(n)) return true |
| 142 | // SECURITY: leading `../` or absolute paths that resolveCwdReentry and |
| 143 | // posix.normalize couldn't fully resolve. Resolve against actual cwd — if |
| 144 | // the result lands back in cwd at a git-internal location, the guard must |
| 145 | // still fire. |
| 146 | if (n.startsWith('../') || n.startsWith('/') || /^[a-z]:/.test(n)) { |
| 147 | const rel = resolveEscapingPathToCwdRelative(n) |
| 148 | if (rel !== null && matchesGitInternalPrefix(rel)) return true |
| 149 | } |
| 150 | return false |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * True if arg resolves to a path inside .git/ (standard-repo metadata dir). |
no test coverage detected