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.next_inode += 1;
state state
.write_path(&cur_path, |entry| { .write_path(&cur_path, |entry| {
entry.or_insert(Arc::new(Mutex::new(FakeFsEntry::Dir { entry.or_insert_with(|| {
inode, created_dirs.push(cur_path.clone());
mtime: SystemTime::now(), Arc::new(Mutex::new(FakeFsEntry::Dir {
entries: Default::default(), inode,
}))); mtime: SystemTime::now(),
created_dirs.push(cur_path.clone()); entries: Default::default(),
}))
});
Ok(()) Ok(())
}) })
.await?; .await?;