(
root: &Path,
bytes: &[u8],
must_exist: bool,
)
| 454 | } |
| 455 | |
| 456 | fn resolve_git_path( |
| 457 | root: &Path, |
| 458 | bytes: &[u8], |
| 459 | must_exist: bool, |
| 460 | ) -> Result<PathBuf, RepositoryError> { |
| 461 | let raw = path_from_bytes(bytes)?; |
| 462 | let path = if raw.is_absolute() { |
| 463 | raw |
| 464 | } else { |
| 465 | root.join(raw) |
| 466 | }; |
| 467 | if must_exist { |
| 468 | canonical_existing(&path, "Git administrative path") |
| 469 | } else { |
| 470 | canonicalize_missing_leaf(&path) |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | #[cfg(unix)] |
| 475 | fn path_from_bytes(bytes: &[u8]) -> Result<PathBuf, RepositoryError> { |
no test coverage detected