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

Method isPathExcluded

internal/diff/git.go:313–315  ·  view source on GitHub ↗

isPathExcluded returns true when the given relative file path should be skipped based on hardcoded dir rules or .gitignore patterns. Patterns are resolved the way git resolves them: in file order, with the LAST matching pattern deciding, and a leading "!" inverting that pattern's verdict. Order mat

(relPath string, gitignorePatterns []string)

Source from the content-addressed store, hash-verified

311// correct under last-match-wins. Treating negations as unmatchable made every
312// file in such a repository look excluded, so a review silently covered nothing.
313func (p *Provider) isPathExcluded(relPath string, gitignorePatterns []string) bool {
314 return isProviderDirExcluded(relPath) || GitignorePatterns(gitignorePatterns).Matches(relPath)
315}
316
317func (patterns GitignorePatterns) Matches(relPath string) bool {
318 excluded := false

Callers 2

untrackedFilesListMethod · 0.95
IsPathExcludedFunction · 0.95

Calls 3

isProviderDirExcludedFunction · 0.85
GitignorePatternsTypeAlias · 0.85
MatchesMethod · 0.80

Tested by

no test coverage detected