rust/hg-core/src/dirstate/dirs_multiset.rs
changeset 43808 1fe2e574616e
parent 42960 7a01778bc7b7
child 43844 5ac243a92e37
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs	Sun Dec 01 18:46:10 2019 -0500
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs	Fri Nov 22 10:39:05 2019 +0100
@@ -65,14 +65,20 @@
     /// Increases the count of deepest directory contained in the path.
     ///
     /// If the directory is not yet in the map, adds its parents.
-    pub fn add_path(&mut self, path: &HgPath) {
+    pub fn add_path(&mut self, path: &HgPath) -> Result<(), DirstateMapError> {
         for subpath in files::find_dirs(path) {
+            if subpath.as_bytes().last() == Some(&b'/') {
+                // TODO Remove this once PathAuditor is certified
+                // as the only entrypoint for path data
+                return Err(DirstateMapError::ConsecutiveSlashes);
+            }
             if let Some(val) = self.inner.get_mut(subpath) {
                 *val += 1;
                 break;
             }
             self.inner.insert(subpath.to_owned(), 1);
         }
+        Ok(())
     }
 
     /// Decreases the count of deepest directory contained in the path.