partitionDiffs keeps diffs filtered by built-in directory rules available for reporting while preserving the review input as the Included slice. In workspace mode, ignored untracked files are already filtered out. Applying .gitignore here would incorrectly drop tracked changes.
(diffs []model.Diff, patterns GitignorePatterns)
| 441 | // In workspace mode, ignored untracked files are already filtered out. |
| 442 | // Applying .gitignore here would incorrectly drop tracked changes. |
| 443 | func partitionDiffs(diffs []model.Diff, patterns GitignorePatterns) DiffSet { |
| 444 | result := DiffSet{ |
| 445 | Included: make([]model.Diff, 0, len(diffs)), |
| 446 | Excluded: make([]model.Diff, 0), |
| 447 | } |
| 448 | for _, d := range diffs { |
| 449 | path := d.NewPath |
| 450 | if path == "/dev/null" { |
| 451 | path = d.OldPath |
| 452 | } |
| 453 | if isProviderDirExcluded(path) { |
| 454 | result.excludedAt = append(result.excludedAt, len(result.Included)+len(result.Excluded)) |
| 455 | result.Excluded = append(result.Excluded, d) |
| 456 | } else if !patterns.Matches(path) { |
| 457 | result.Included = append(result.Included, d) |
| 458 | } |
| 459 | } |
| 460 | return result |
| 461 | } |
| 462 | |
| 463 | // ---- Internal helpers ---- |
| 464 |
no test coverage detected