MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / injection_relative_path

Function injection_relative_path

atomic-repository/src/repository/adoption.rs:3110–3126  ·  view source on GitHub ↗
(
    root: &std::path::Path,
    relative: &str,
)

Source from the content-addressed store, hash-verified

3108/// feature build cannot reach outside the worktree or smuggle options.
3109#[cfg(feature = "adoption-test-injection")]
3110fn injection_relative_path(
3111 root: &std::path::Path,
3112 relative: &str,
3113) -> Result<std::path::PathBuf, RepositoryError> {
3114 let path = std::path::Path::new(relative);
3115 if relative.is_empty()
3116 || path.is_absolute()
3117 || path
3118 .components()
3119 .any(|component| component == std::path::Component::ParentDir)
3120 {
3121 return Err(RepositoryError::InvalidOperation {
3122 message: format!("test injection path must stay inside the worktree: {relative:?}"),
3123 });
3124 }
3125 Ok(root.join(path))
3126}
3127
3128/// R7: one level of the unexplained-worktree scan. Every observation error
3129/// is propagated (`Err`), never swallowed: a partial scan cannot establish

Callers 1

adoption_injectionFunction · 0.85

Calls 2

componentsMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected