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

Function isDotGitPathPS

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

Source from the content-addressed store, hash-verified

156 * `hooks/`, `refs/` etc. — those are common project directory names.
157 */
158export 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
170function matchesDotGitPrefix(n: string): boolean {
171 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