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

Function resolve_git_path

atomic-repository/src/repository/working_copy.rs:456–472  ·  view source on GitHub ↗
(
    root: &Path,
    bytes: &[u8],
    must_exist: bool,
)

Source from the content-addressed store, hash-verified

454}
455
456fn 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)]
475fn path_from_bytes(bytes: &[u8]) -> Result<PathBuf, RepositoryError> {

Callers 1

resolve_git_adminFunction · 0.85

Calls 3

path_from_bytesFunction · 0.85
canonical_existingFunction · 0.85

Tested by

no test coverage detected