MCPcopy Create free account
hub / github.com/alibaba/open-code-review / matchGitignorePattern

Function matchGitignorePattern

internal/diff/git.go:353–358  ·  view source on GitHub ↗

matchGitignorePattern checks if relPath matches a single .gitignore pattern. Polarity is not this function's concern: a negated pattern reports false, so callers testing one pattern in isolation still read it as "does this exclude the path". Ordered resolution across a whole pattern list, where neg

(relPath, pat string)

Source from the content-addressed store, hash-verified

351// the path". Ordered resolution across a whole pattern list, where negations do
352// carry meaning, lives in isPathExcluded.
353func matchGitignorePattern(relPath, pat string) bool {
354 if strings.HasPrefix(pat, "!") {
355 return false
356 }
357 return matchGitignoreBody(relPath, pat)
358}
359
360// matchGitignoreBody reports whether relPath matches a single pattern body —
361// the pattern with any leading "!" already stripped.

Callers 1

MatchGitignorePatternFunction · 0.85

Calls 1

matchGitignoreBodyFunction · 0.85

Tested by

no test coverage detected