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