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,
)
| 418 | /// let recorded = record_deleted_file(&detected_file, &options)?; |
| 419 | /// ``` |
| 420 | pub fn record_deleted_file( |
| 421 | detected: &DetectedFile, |
| 422 | _options: &RecordingOptions, |
| 423 | ) -> Result<RecordedFile, String> { |
| 424 | let mut recorded = RecordedFile::new(&detected.path); |
| 425 | recorded.set_kind(DetectionKind::Deleted); |
| 426 | |
| 427 | // Copy inode and position if available |
| 428 | if let Some(inode) = detected.inode { |
| 429 | recorded.set_inode(inode); |
| 430 | } |
| 431 | if let Some(position) = detected.position { |
| 432 | recorded.set_position(position); |
| 433 | } |
| 434 | |
| 435 | // Create a deletion graph_op for the whole file. |
| 436 | // |
| 437 | // An EMPTY `deleted_lines` signals a whole-file deletion: globalize_delete |
| 438 | // then skips its targeted (line-range) branch and marks EVERY content |
| 439 | // vertex deleted. The previous `vec![0]` placeholder made the targeted |
| 440 | // branch delete only the first line, so inserting the delete into another |
| 441 | // view left the file's tail alive (docs/MERGE-CONFLICT-RUBRIC.md §6.5). |
| 442 | let local = Local::new(&detected.path, 1); |
| 443 | let encoding = detected.encoding; |
| 444 | let graph_op = BuiltHunk::new_delete(local, encoding, Vec::new(), 0); |
| 445 | recorded.add_hunk(graph_op); |
| 446 | |
| 447 | // Generate CRDT operations for the deletion |
| 448 | let crdt_ops = crdt::build_crdt_ops_for_deleted_file(&detected.path); |
| 449 | recorded.set_crdt_ops(crdt_ops.0); |
| 450 | recorded.set_crdt_stats(crdt_ops.1); |
| 451 | |
| 452 | Ok(recorded) |
| 453 | } |
| 454 | |
| 455 | /// Record a single modified file. |
| 456 | /// |