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)
| 351 | // the path". Ordered resolution across a whole pattern list, where negations do |
| 352 | // carry meaning, lives in isPathExcluded. |
| 353 | func 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. |
no test coverage detected