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

Function resolve_path

atomic-cli/src/commands/git/observation.rs:1470–1486  ·  view source on GitHub ↗
(path: &Path, base: &Path)

Source from the content-addressed store, hash-verified

1468}
1469
1470fn resolve_path(path: &Path, base: &Path) -> Result<PathBuf, ObservationError> {
1471 let absolute = if path.is_absolute() {
1472 path.to_path_buf()
1473 } else {
1474 let base = if base.is_absolute() {
1475 base.to_path_buf()
1476 } else {
1477 std::env::current_dir()
1478 .map_err(|error| {
1479 ObservationError::new(format!("cannot resolve current directory: {error}"))
1480 })?
1481 .join(base)
1482 };
1483 base.join(path)
1484 };
1485 Ok(fs::canonicalize(&absolute).unwrap_or(absolute))
1486}
1487
1488/// Reversible display for raw Git path/ref bytes.
1489pub fn display_git_bytes(bytes: &[u8]) -> String {

Callers 3

observe_gitFunction · 0.85
observe_open_repositoryFunction · 0.85
resolve_common_dirFunction · 0.85

Calls 1

canonicalizeFunction · 0.50

Tested by

no test coverage detected