Record a single deleted file. Creates a deletion graph_op for a file that no longer exists in the working copy. # Arguments `detected` - The detected file `options` - Recording options # Returns A `RecordedFile` with deletion hunks. # Example ```rust,ignore use atomic_core::record::workflow::record::{record_deleted_file, RecordingOptions}; let options = RecordingOptions::new(); let recorde
(
detected: &DetectedFile,
_options: &RecordingOptions,
)
| 295 | /// let recorded = record_deleted_file(&detected_file, &options)?; |
| 296 | /// ``` |
| 297 | pub fn record_deleted_file( |
| 298 | detected: &DetectedFile, |
| 299 | _options: &RecordingOptions, |
| 300 | ) -> Result<RecordedFile, String> { |
| 301 | let mut recorded = RecordedFile::new(&detected.path); |
| 302 | recorded.set_kind(DetectionKind::Deleted); |
| 303 | |
| 304 | // Copy inode and position if available |
| 305 | if let Some(inode) = detected.inode { |
| 306 | recorded.set_inode(inode); |
| 307 | } |
| 308 | if let Some(position) = detected.position { |
| 309 | recorded.set_position(position); |
| 310 | } |
| 311 | |
| 312 | // Create a deletion graph_op for the file. |
| 313 | // The actual line information would come from the pristine graph traversal |
| 314 | // when integrated with the full repository context. The deletion graph_op |
| 315 | // marks the file's content edges as deleted in the graph. |
| 316 | let local = Local::new(&detected.path, 1); |
| 317 | let encoding = detected.encoding; |
| 318 | let graph_op = BuiltHunk::new_delete(local, encoding, vec![0], 0); |
| 319 | recorded.add_hunk(graph_op); |
| 320 | |
| 321 | // Generate CRDT operations for the deletion |
| 322 | let crdt_ops = crdt::build_crdt_ops_for_deleted_file(&detected.path); |
| 323 | recorded.set_crdt_ops(crdt_ops.0); |
| 324 | recorded.set_crdt_stats(crdt_ops.1); |
| 325 | |
| 326 | Ok(recorded) |
| 327 | } |
| 328 | |
| 329 | /// Record a single modified file. |
| 330 | /// |