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

Function working_copy_diff_bytes

libatomic/src/daemon/services_query.rs:188–206  ·  view source on GitHub ↗
(path: &std::path::Path)

Source from the content-addressed store, hash-verified

186}
187
188fn working_copy_diff_bytes(path: &std::path::Path) -> std::io::Result<Vec<u8>> {
189 let metadata = std::fs::symlink_metadata(path)?;
190 if metadata.file_type().is_symlink() {
191 #[cfg(unix)]
192 {
193 use std::os::unix::ffi::OsStrExt;
194 return Ok(std::fs::read_link(path)?.as_os_str().as_bytes().to_vec());
195 }
196 #[cfg(not(unix))]
197 return Err(std::io::Error::new(
198 std::io::ErrorKind::Unsupported,
199 "symlink diff is unsupported on this platform",
200 ));
201 }
202 if metadata.is_dir() {
203 return Ok(Vec::new());
204 }
205 std::fs::read(path)
206}
207
208/// The wire's downcased file status for a diff chunk — the CLI renders
209/// name-status and /dev/null headers from this.

Callers 1

Calls 3

is_dirMethod · 0.80
readFunction · 0.50
as_bytesMethod · 0.45

Tested by

no test coverage detected