(
path: &str,
new_content: &[u8],
diff_lines: &[GitDiffLine],
kind: atomic_core::record::workflow::DetectionKind,
)
| 1045 | } |
| 1046 | |
| 1047 | fn record_git_diff_add_fast( |
| 1048 | path: &str, |
| 1049 | new_content: &[u8], |
| 1050 | diff_lines: &[GitDiffLine], |
| 1051 | kind: atomic_core::record::workflow::DetectionKind, |
| 1052 | ) -> Option<RecordedFile> { |
| 1053 | let encoding = Encoding::detect(new_content); |
| 1054 | if encoding == Encoding::Binary { |
| 1055 | return None; |
| 1056 | } |
| 1057 | |
| 1058 | let mut recorded = RecordedFile::new(path); |
| 1059 | recorded.set_kind(kind); |
| 1060 | recorded.set_encoding(encoding); |
| 1061 | recorded.add_hunk(BuiltHunk::new_edit( |
| 1062 | Local::new(path, 1), |
| 1063 | Some(encoding), |
| 1064 | 0, |
| 1065 | new_content.len() as u64, |
| 1066 | )); |
| 1067 | recorded.set_content(new_content.to_vec()); |
| 1068 | |
| 1069 | let (git_file_ops, git_stats) = |
| 1070 | atomic_core::record::workflow::build_crdt_ops_from_git_diff(path, diff_lines); |
| 1071 | recorded.set_crdt_ops(git_file_ops); |
| 1072 | recorded.set_crdt_stats(git_stats); |
| 1073 | Some(recorded) |
| 1074 | } |
| 1075 | |
| 1076 | fn build_linewise_crdt_ops_for_added_file( |
| 1077 | path: &str, |
no test coverage detected