diff options
author | Benjamin Nguyen <benjamin.van.nguyen@gmail.com> | 2023-12-02 14:15:15 -0800 |
---|---|---|
committer | Benjamin Nguyen <benjamin.van.nguyen@gmail.com> | 2023-12-02 14:15:15 -0800 |
commit | 573838b4d5bf30f44e5ce23b847bfa1e6d2243b5 (patch) | |
tree | fb107db93465c251cbedd9968d2a015ecfd03404 | |
parent | f55bd00c2deea3311394a35396fc2574015a4853 (diff) |
don't prune removed nodes
-rw-r--r-- | src/file/tree/filter.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/file/tree/filter.rs b/src/file/tree/filter.rs index 55d53a0..0410159 100644 --- a/src/file/tree/filter.rs +++ b/src/file/tree/filter.rs @@ -55,8 +55,8 @@ impl Tree { while pruning { let mut to_remove = vec![]; - for n in self.root_id.descendants(&self.arena) { - if self.arena[n].get().is_dir() && n.children(&self.arena).count() == 0 { + for n in self.root_id.descendants(&self.arena).skip(1) { + if !n.is_removed(&self.arena) && self.arena[n].get().is_dir() && n.children(&self.arena).count() == 0 { to_remove.push(n); } } @@ -168,6 +168,7 @@ impl Tree { Ok(()) } + /// Filtering via globbing fn filter_glob(&mut self, ctx: &Context) -> Result<()> { let Context { globbing: Globbing { iglob, .. }, |