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

Function canonical_tree_path

atomic-cli/src/commands/git/parallel.rs:9604–9622  ·  view source on GitHub ↗

A physical filesystem path decoded from the canonical String identity.

(path: &str)

Source from the content-addressed store, hash-verified

9602
9603/// A physical filesystem path decoded from the canonical String identity.
9604pub(super) fn canonical_tree_path(path: &str) -> PathBuf {
9605 match atomic_repository::unescape_repo_path(path) {
9606 Ok(raw) => {
9607 #[cfg(unix)]
9608 {
9609 use std::os::unix::ffi::OsStringExt;
9610 PathBuf::from(std::ffi::OsString::from_vec(raw))
9611 }
9612 #[cfg(not(unix))]
9613 {
9614 match String::from_utf8(raw) {
9615 Ok(decoded) => PathBuf::from(decoded),
9616 Err(_) => PathBuf::from(path),
9617 }
9618 }
9619 }
9620 Err(_) => PathBuf::from(path),
9621 }
9622}
9623
9624/// Look up raw Git path components without routing them through host paths.
9625/// Git trees can contain names (including non-UTF-8 bytes) that the host

Callers 4

pathsMethod · 0.85
reindex_working_copyFunction · 0.85
phase2_writeMethod · 0.85

Calls 1

unescape_repo_pathFunction · 0.85

Tested by

no test coverage detected