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 whole file. |
| 313 | // |
| 314 | // An EMPTY `deleted_lines` signals a whole-file deletion: globalize_delete |
| 315 | // then skips its targeted (line-range) branch and marks EVERY content |
| 316 | // vertex deleted. The previous `vec![0]` placeholder made the targeted |
| 317 | // branch delete only the first line, so inserting the delete into another |
| 318 | // view left the file's tail alive (docs/MERGE-CONFLICT-RUBRIC.md §6.5). |
| 319 | let local = Local::new(&detected.path, 1); |
| 320 | let encoding = detected.encoding; |
| 321 | let graph_op = BuiltHunk::new_delete(local, encoding, Vec::new(), 0); |
| 322 | recorded.add_hunk(graph_op); |
| 323 | |
| 324 | // Generate CRDT operations for the deletion |
| 325 | let crdt_ops = crdt::build_crdt_ops_for_deleted_file(&detected.path); |
| 326 | recorded.set_crdt_ops(crdt_ops.0); |
| 327 | recorded.set_crdt_stats(crdt_ops.1); |
| 328 | |
| 329 | Ok(recorded) |
| 330 | } |
| 331 | |
| 332 | /// Record a single modified file. |
| 333 | /// |