A physical filesystem path decoded from the canonical String identity.
(path: &str)
| 9602 | |
| 9603 | /// A physical filesystem path decoded from the canonical String identity. |
| 9604 | pub(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 |
no test coverage detected