fix: add back self.depth assertions in set_path

This commit is contained in:
Joonas Koivunen 2020-06-17 16:18:43 +03:00
parent 3bfa506f69
commit 7b7ddbbe2b

View File

@ -488,13 +488,17 @@ impl InnerEntry {
}
fn set_path(&mut self, name: &str, depth: usize) {
debug_assert_eq!(self.depth, self.path.ancestors().count());
while self.depth >= depth && self.depth > 0 {
assert!(self.path.pop());
self.depth -= 1;
self.depth = self.depth.checked_sub(1).expect("undeflowed path components");
}
self.path.push(name);
self.depth = depth;
debug_assert_eq!(self.depth, self.path.ancestors().count());
}
fn as_directory(&mut self, cid: Cid, name: &str, depth: usize, metadata: Metadata) {