aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_status.go
diff options
context:
space:
mode:
Diffstat (limited to 'worktree_status.go')
-rw-r--r--worktree_status.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/worktree_status.go b/worktree_status.go
index 1eee042..dd9b243 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) gitignoreMatcher() (gitignore.Matcher, error) {
+func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes {
patterns, err := gitignore.ReadPatterns(w.Filesystem, nil)
if err != nil {
- return nil, err
+ return changes
}
+
patterns = append(patterns, w.Excludes...)
- return gitignore.NewMatcher(patterns), nil
-}
-
-func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes {
- m, err := w.gitignoreMatcher()
- if err != nil {
+
+ if len(patterns) == 0 {
return changes
}
+
+ m := gitignore.NewMatcher(patterns)
+
var res merkletrie.Changes
for _, ch := range changes {
var path []string