(
path: &str,
new_content: &[u8],
diff_lines: &[GitDiffLine],
kind: atomic_core::record::workflow::DetectionKind,
)
| 1001 | } |
| 1002 | |
| 1003 | fn record_git_diff_add_fast( |
| 1004 | path: &str, |
| 1005 | new_content: &[u8], |
| 1006 | diff_lines: &[GitDiffLine], |
| 1007 | kind: atomic_core::record::workflow::DetectionKind, |
| 1008 | ) -> Option<RecordedFile> { |
| 1009 | let encoding = Encoding::detect(new_content); |
| 1010 | if encoding == Encoding::Binary { |
| 1011 | return None; |
| 1012 | } |
| 1013 | |
| 1014 | let mut recorded = RecordedFile::new(path); |
| 1015 | recorded.set_kind(kind); |
| 1016 | recorded.set_encoding(encoding); |
| 1017 | recorded.add_hunk(BuiltHunk::new_edit( |
| 1018 | Local::new(path, 1), |
| 1019 | Some(encoding), |
| 1020 | 0, |
| 1021 | new_content.len() as u64, |
| 1022 | )); |
| 1023 | recorded.set_content(new_content.to_vec()); |
| 1024 | |
| 1025 | let (git_file_ops, git_stats) = |
| 1026 | atomic_core::record::workflow::build_crdt_ops_from_git_diff(path, diff_lines); |
| 1027 | recorded.set_crdt_ops(git_file_ops); |
| 1028 | recorded.set_crdt_stats(git_stats); |
| 1029 | Some(recorded) |
| 1030 | } |
| 1031 | |
| 1032 | fn build_linewise_crdt_ops_for_added_file( |
| 1033 | path: &str, |
no test coverage detected