# HG changeset patch # User Raphaël Gomès # Date 1727913164 -7200 # Node ID 503b7688f05723e086a27539b8ad89c37ff0ee01 # Parent de317a87ea6a6765408786e45e0900986875a5a6 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. diff -r de317a87ea6a -r 503b7688f057 rust/hg-core/src/utils/path_auditor.rs --- 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