loadGitignorePatterns reads and parses .gitignore patterns from the repo root.
()
| 231 | |
| 232 | // loadGitignorePatterns reads and parses .gitignore patterns from the repo root. |
| 233 | func (p *Provider) loadGitignorePatterns() []string { |
| 234 | data, err := os.ReadFile(filepath.Join(p.repoDir, ".gitignore")) |
| 235 | if err != nil { |
| 236 | return nil |
| 237 | } |
| 238 | var patterns []string |
| 239 | for line := range strings.SplitSeq(string(data), "\n") { |
| 240 | line = strings.TrimSpace(line) |
| 241 | if line == "" || strings.HasPrefix(line, "#") { |
| 242 | continue |
| 243 | } |
| 244 | patterns = append(patterns, line) |
| 245 | } |
| 246 | return patterns |
| 247 | } |
| 248 | |
| 249 | // isPathExcluded returns true when the given relative file path should be skipped |
| 250 | // based on hardcoded dir rules or .gitignore patterns. |
no outgoing calls
no test coverage detected