MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isGitInternalPathPS

Function isGitInternalPathPS

src/tools/PowerShellTool/gitSafety.ts:139–151  ·  view source on GitHub ↗
(arg: string)

Source from the content-addressed store, hash-verified

137 * (.git/hooks/, .git/config).
138 */
139export 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).

Callers 1

Calls 4

resolveCwdReentryFunction · 0.85
normalizeGitPathArgFunction · 0.85
matchesGitInternalPrefixFunction · 0.85

Tested by

no test coverage detected