loadGitignorePatterns reads and parses .gitignore patterns from the repo root.
()
| 275 | |
| 276 | // loadGitignorePatterns reads and parses .gitignore patterns from the repo root. |
| 277 | func (p *Provider) loadGitignorePatterns() []string { |
| 278 | data, err := os.ReadFile(filepath.Join(p.repoDir, ".gitignore")) |
| 279 | if err != nil { |
| 280 | return nil |
| 281 | } |
| 282 | var patterns []string |
| 283 | for line := range strings.SplitSeq(string(data), "\n") { |
| 284 | line = strings.TrimSpace(line) |
| 285 | if line == "" || strings.HasPrefix(line, "#") { |
| 286 | continue |
| 287 | } |
| 288 | patterns = append(patterns, line) |
| 289 | } |
| 290 | return patterns |
| 291 | } |
| 292 | |
| 293 | // isPathExcluded returns true when the given relative file path should be skipped |
| 294 | // based on hardcoded dir rules or .gitignore patterns. |
no outgoing calls
no test coverage detected