diff options
Diffstat (limited to 'worktree_status.go')
-rw-r--r-- | worktree_status.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/worktree_status.go b/worktree_status.go index 7301087..c07bc6b 100644 --- a/worktree_status.go +++ b/worktree_status.go @@ -144,20 +144,20 @@ func (w *Worktree) diffStagingWithWorktree(reverse, excludeIgnoredChanges bool) return c, nil } -func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes { +func (w *Worktree) gitignoreMatcher() (gitignore.Matcher, error) { patterns, err := gitignore.ReadPatterns(w.Filesystem, nil) if err != nil { - return changes + return nil, err } - patterns = append(patterns, w.Excludes...) - - if len(patterns) == 0 { + return gitignore.NewMatcher(patterns), nil +} + +func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes { + m, err := w.gitignoreMatcher() + if err != nil { return changes } - - m := gitignore.NewMatcher(patterns) - var res merkletrie.Changes for _, ch := range changes { var path []string |