mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
fix: bug where hard links could be double counted
When running: dust dir_a dir_b if a file was hard linked in both dir_a and dir_b it would be double counted. This fix resolves this by keeping the shared hashmap around between runs for the second and subsequent arguments. https://github.com/bootandy/dust/issues/282
This commit is contained in:
+2
-1
@@ -31,12 +31,13 @@ pub struct WalkData<'a> {
|
||||
pub fn walk_it(dirs: HashSet<PathBuf>, walk_data: WalkData) -> (Vec<Node>, bool) {
|
||||
let permissions_flag = AtomicBool::new(false);
|
||||
|
||||
let mut inodes = HashSet::new();
|
||||
let top_level_nodes: Vec<_> = dirs
|
||||
.into_iter()
|
||||
.filter_map(|d| {
|
||||
clean_inodes(
|
||||
walk(d, &permissions_flag, &walk_data, 0)?,
|
||||
&mut HashSet::new(),
|
||||
&mut inodes,
|
||||
walk_data.use_apparent_size,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user