Skip to content

Commit

Permalink
fix duplicated entries in --matched option
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-ward committed Jan 7, 2025
1 parent 85be120 commit b728adf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lsv/entry.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ struct Entry {
invalid bool // lstat could not access
}

fn (a Entry) == (b Entry) bool {
return a.name == b.name
}

fn (a Entry) < (b Entry) bool {
return a.name < b.name
}

fn get_entries(files []string, options Options) []Entry {
mut entries := []Entry{cap: 50}

Expand Down
3 changes: 2 additions & 1 deletion lsv/filter.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import arrays
import time

enum ByTime {
Expand Down Expand Up @@ -31,7 +32,7 @@ fn filter(entries []Entry, options Options) []Entry {
for glob in options.glob_match.split('|') {
matched << filtered.filter(it.name.match_glob(glob))
}
filtered = matched.clone()
filtered = arrays.distinct(matched)
}

filtered = filter_time(filtered, options.time_before_modified, .before_modified)
Expand Down

0 comments on commit b728adf

Please sign in to comment.