Execute dry-run for a single file - output pristine content to stdout.
(&self, repo: &Repository, path: &str)
| 218 | |
| 219 | /// Execute dry-run for a single file - output pristine content to stdout. |
| 220 | fn dry_run_single_file(&self, repo: &Repository, path: &str) -> CliResult<()> { |
| 221 | // Get file content from pristine |
| 222 | let content = repo.get_file_content(Path::new(path)).map_err(|e| { |
| 223 | CliError::Internal(anyhow::anyhow!("Failed to get file content: {}", e)) |
| 224 | })?; |
| 225 | |
| 226 | match content { |
| 227 | Some(bytes) => { |
| 228 | // Output to stdout |
| 229 | use std::io::Write; |
| 230 | std::io::stdout() |
| 231 | .write_all(&bytes) |
| 232 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to write: {}", e)))?; |
| 233 | Ok(()) |
| 234 | } |
| 235 | None => Err(CliError::FileNotFound { |
| 236 | path: PathBuf::from(path), |
| 237 | }), |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /// Restore a single file according to its status. |
| 242 | /// |