mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
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:
committed by
andy.boot
parent
3f2f7a8bb2
commit
58c9f6d509
+3
-2
@@ -34,11 +34,12 @@ pub fn simplify_dir_names<P: AsRef<Path>>(filenames: Vec<P>) -> HashSet<PathBuf>
|
||||
top_level_names
|
||||
}
|
||||
|
||||
pub fn get_filesystem_devices<'a, P: IntoIterator<Item = &'a PathBuf>>(paths: P) -> HashSet<u64> {
|
||||
pub fn get_filesystem_devices<'a, P: IntoIterator<Item = &'a str>>(paths: P) -> HashSet<u64> {
|
||||
// Gets the device ids for the filesystems which are used by the argument paths
|
||||
paths
|
||||
.into_iter()
|
||||
.filter_map(|p| match get_metadata(p, false) {
|
||||
.map(PathBuf::from)
|
||||
.filter_map(|p| match get_metadata(&p, false) {
|
||||
Some((_size, Some((_id, dev)), _time)) => Some(dev),
|
||||
_ => None,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user