From 0e2653c087e1284abd9611ac0b6dd2bff50c60ff Mon Sep 17 00:00:00 2001 From: Avril Date: Wed, 10 Feb 2021 13:59:37 +0000 Subject: [PATCH] fix path root joining fix path insertion --- src/work.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/work.rs b/src/work.rs index a5ebe22..f877499 100644 --- a/src/work.rs +++ b/src/work.rs @@ -69,14 +69,16 @@ pub async fn work_on_all(state: State) -> INodeInfoGraph for path_comp in comp_children { - if let Some((res, root)) = path_comp + if let Some((res, _root)) = path_comp { - for (path, ino) in join_root(&root, res) + for (path, ino) in res.into_iter() { // If this inode is not in the map, this is a top-level path. - //if let Some(_) = ino_map.get(&ino) { + //if let Some(_) = ino_map.get(&ino) { + output.insert(path, ino); //XXX: Why does `output` always end up empty??? + //} else { // eprintln!("No ino entry for {:?} ({:?})", path, ino); //} @@ -118,15 +120,17 @@ fn walk(state: State, root: PathBuf, root_ino: INode) -> BoxFuture<'static, Hash // Not added, process. match process_entry(&entry, root_ino).await { Ok(fsinfo) => { + let path = entry.path(); if fsinfo.is_dir() { if let Some(next) = state.deeper() { children.push(tokio::spawn( - walk(next, entry.path(), ino) + walk(next, path.clone(), ino) )); } } + output.insert(path, ino); let mut cache = state.cache_sub(); cache.insert(ino, fsinfo).await; }, @@ -147,7 +151,7 @@ fn walk(state: State, root: PathBuf, root_ino: INode) -> BoxFuture<'static, Hash { if let Ok(map) = child { - output.extend(join_root(&root, map)); + output.extend(map);//join_root(&root, map)); } else { eprintln!("Child panic"); }