Avoid unnecessarily emitting fake fs events for dirs that exist

This commit is contained in:
Antonio Scandurra 2022-07-18 17:36:40 +02:00
parent f9df5fe595
commit 11ef6bfbae

View file

@ -554,12 +554,14 @@ impl Fs for FakeFs {
state.next_inode += 1;
state
.write_path(&cur_path, |entry| {
entry.or_insert(Arc::new(Mutex::new(FakeFsEntry::Dir {
entry.or_insert_with(|| {
created_dirs.push(cur_path.clone());
Arc::new(Mutex::new(FakeFsEntry::Dir {
inode,
mtime: SystemTime::now(),
entries: Default::default(),
})));
created_dirs.push(cur_path.clone());
}))
});
Ok(())
})
.await?;