(path: &std::path::Path)
| 186 | } |
| 187 | |
| 188 | fn 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. |
no test coverage detected