Reconstruct a line's text content from its leaf operations.
(leaf_ops: &[LeafOp])
| 491 | |
| 492 | /// Reconstruct a line's text content from its leaf operations. |
| 493 | pub(super) fn reconstruct_line_from_leaf_ops(leaf_ops: &[LeafOp]) -> String { |
| 494 | let mut line = String::new(); |
| 495 | for leaf_op in leaf_ops { |
| 496 | match leaf_op { |
| 497 | LeafOp::Insert { content, .. } => { |
| 498 | if let Ok(text) = std::str::from_utf8(content) { |
| 499 | line.push_str(text); |
| 500 | } |
| 501 | } |
| 502 | LeafOp::Replace { new_content, .. } => { |
| 503 | if let Ok(text) = std::str::from_utf8(new_content) { |
| 504 | line.push_str(text); |
| 505 | } |
| 506 | } |
| 507 | LeafOp::Delete { .. } | LeafOp::Restore { .. } => { |
| 508 | // These don't add content to the line |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | line |
| 513 | } |
| 514 | |
| 515 | fn is_git_import_change(change: &Change) -> bool { |
| 516 | change |
nothing calls this directly
no outgoing calls
no test coverage detected