Fix -x option behavior

This PR addresses an issue where `target_dirs` were being optimized out\
before being passed to the `get_filesystem_devices()` function.
The changes in this PR ensure that `target_dirs` are passed directly
to `get_filesystem_devices()`, and only then are they simplified.

Example of a command that currently doesn't work correctly:
```sh
dust -x $(findmnt -S tmpfs -o target -n)
```

It should show the usage of all tmpfs mounts, but it currently shows
just the the root mountpoints like `/run`, since all the mountpoints
nested under it are optimized out.
This commit is contained in:
Jan Chren ~rindeal
2024-06-24 04:29:05 +00:00
committed by andy.boot
parent 3f2f7a8bb2
commit 58c9f6d509
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -192,10 +192,10 @@ fn main() {
let limit_filesystem = options.get_flag("limit_filesystem");
let follow_links = options.get_flag("dereference_links");
let simplified_dirs = simplify_dir_names(target_dirs);
let allowed_filesystems = limit_filesystem
.then(|| get_filesystem_devices(simplified_dirs.iter()))
.then(|| get_filesystem_devices(target_dirs.iter().cloned()))
.unwrap_or_default();
let simplified_dirs = simplify_dir_names(target_dirs);
let ignored_full_path: HashSet<PathBuf> = ignore_directories
.into_iter()