loadGitignorePatterns reads and parses .gitignore patterns from the repo root.
()
| 167 | |
| 168 | // loadGitignorePatterns reads and parses .gitignore patterns from the repo root. |
| 169 | func (p *Provider) loadGitignorePatterns() []string { |
| 170 | data, err := os.ReadFile(filepath.Join(p.repoDir, ".gitignore")) |
| 171 | if err != nil { |
| 172 | return nil |
| 173 | } |
| 174 | var patterns []string |
| 175 | for line := range strings.SplitSeq(string(data), "\n") { |
| 176 | line = strings.TrimSpace(line) |
| 177 | if line == "" || strings.HasPrefix(line, "#") { |
| 178 | continue |
| 179 | } |
| 180 | patterns = append(patterns, line) |
| 181 | } |
| 182 | return patterns |
| 183 | } |
| 184 | |
| 185 | // isPathExcluded returns true when the given relative file path should be skipped |
| 186 | // based on hardcoded dir rules or .gitignore patterns. |
no outgoing calls
no test coverage detected