(path: &Path, base: &Path)
| 1468 | } |
| 1469 | |
| 1470 | fn 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. |
| 1489 | pub fn display_git_bytes(bytes: &[u8]) -> String { |
no test coverage detected