Mercurial > hg
changeset 52051:503b7688f057
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.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 03 Oct 2024 01:52:44 +0200 |
parents | de317a87ea6a |
children | db5c202eff36 |
files | rust/hg-core/src/utils/path_auditor.rs |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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