MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isDotGitPathPS

Function isDotGitPathPS

source code/tools/PowerShellTool/gitSafety.ts:160–170  ·  view source on GitHub ↗
(arg: string)

Source from the content-addressed store, hash-verified

158 * `hooks/`, `refs/` etc. — those are common project directory names.
159 */
160export 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
172function matchesDotGitPrefix(n: string): boolean {
173 if (n === '.git' || n.startsWith('.git/')) return true

Callers 1

Calls 4

resolveCwdReentryFunction · 0.85
normalizeGitPathArgFunction · 0.85
matchesDotGitPrefixFunction · 0.85

Tested by

no test coverage detected