rust-pathauditor: make sure we actually test the nested repo case
This covers the *on-disk* case, where the path itself does not have a `.hg`
component.
--- a/rust/hg-core/src/utils/path_auditor.rs Wed Oct 02 20:29:48 2024 +0200
+++ b/rust/hg-core/src/utils/path_auditor.rs Thu Oct 03 01:52:44 2024 +0200
@@ -180,7 +180,7 @@
#[cfg(test)]
mod tests {
use super::*;
- use std::fs::{create_dir, File};
+ use std::fs::{create_dir, create_dir_all, File};
use tempfile::tempdir;
#[test]
@@ -203,6 +203,16 @@
})
);
+ create_dir_all(base_dir_path.join("this/is/nested/.hg")).unwrap();
+ let path = HgPath::new(b"this/is/nested/repo");
+ assert_eq!(
+ auditor.audit_path(path),
+ Err(HgPathError::IsInsideNestedRepo {
+ path: path.to_owned(),
+ nested_repo: HgPathBuf::from_bytes(b"this/is/nested")
+ })
+ );
+
create_dir(base_dir_path.join("realdir")).unwrap();
File::create(base_dir_path.join("realdir/realfile")).unwrap();
// TODO make portable