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

Function observe_path

atomic-cli/src/commands/git/observation.rs:1408–1431  ·  view source on GitHub ↗
(path: PathBuf)

Source from the content-addressed store, hash-verified

1406}
1407
1408fn observe_path(path: PathBuf) -> Result<PathObservation, ObservationError> {
1409 let kind = match fs::symlink_metadata(&path) {
1410 Ok(metadata) => {
1411 let file_type = metadata.file_type();
1412 if file_type.is_symlink() {
1413 AdminEntryKind::Symlink
1414 } else if file_type.is_file() {
1415 AdminEntryKind::File
1416 } else if file_type.is_dir() {
1417 AdminEntryKind::Directory
1418 } else {
1419 AdminEntryKind::Other
1420 }
1421 }
1422 Err(error) if error.kind() == io::ErrorKind::NotFound => AdminEntryKind::Missing,
1423 Err(error) => {
1424 return Err(ObservationError::new(format!(
1425 "cannot inspect Git administrative path '{}': {error}",
1426 path.display()
1427 )));
1428 }
1429 };
1430 Ok(PathObservation { path, kind })
1431}
1432
1433fn append_suffix(path: &Path, suffix: &str) -> PathBuf {
1434 let mut value = path.as_os_str().to_os_string();

Callers 2

observe_locksFunction · 0.70
observe_operationFunction · 0.70

Calls 3

is_dirMethod · 0.80
is_fileMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected