diff options
Diffstat (limited to 'tvix/castore/src/import')
-rw-r--r-- | tvix/castore/src/import/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tvix/castore/src/import/mod.rs b/tvix/castore/src/import/mod.rs index 6c69d04f3026..87e289911300 100644 --- a/tvix/castore/src/import/mod.rs +++ b/tvix/castore/src/import/mod.rs @@ -121,15 +121,17 @@ where }), }; - if entry.path().components().count() == 1 { + let parent = entry + .path() + .parent() + .expect("Tvix bug: got entry with root node"); + + if parent == crate::Path::ROOT { break node; + } else { + // record node in parent directory, creating a new [Directory] if not there yet. + directories.entry(parent.to_owned()).or_default().add(node); } - - // record node in parent directory, creating a new [Directory] if not there yet. - directories - .entry(entry.path().parent().unwrap().to_owned()) - .or_default() - .add(node); }; assert!( |