(
path: &str,
new_content: &[u8],
diff_lines: &[GitDiffLine],
kind: atomic_core::record::workflow::DetectionKind,
)
| 932 | } |
| 933 | |
| 934 | fn record_git_diff_add_fast( |
| 935 | path: &str, |
| 936 | new_content: &[u8], |
| 937 | diff_lines: &[GitDiffLine], |
| 938 | kind: atomic_core::record::workflow::DetectionKind, |
| 939 | ) -> Option<RecordedFile> { |
| 940 | let encoding = Encoding::detect(new_content); |
| 941 | if encoding == Encoding::Binary { |
| 942 | return None; |
| 943 | } |
| 944 | |
| 945 | let mut recorded = RecordedFile::new(path); |
| 946 | recorded.set_kind(kind); |
| 947 | recorded.set_encoding(encoding); |
| 948 | recorded.add_hunk(BuiltHunk::new_edit( |
| 949 | Local::new(path, 1), |
| 950 | Some(encoding), |
| 951 | 0, |
| 952 | new_content.len() as u64, |
| 953 | )); |
| 954 | recorded.set_content(new_content.to_vec()); |
| 955 | |
| 956 | let (git_file_ops, git_stats) = |
| 957 | atomic_core::record::workflow::build_crdt_ops_from_git_diff(path, diff_lines); |
| 958 | recorded.set_crdt_ops(git_file_ops); |
| 959 | recorded.set_crdt_stats(git_stats); |
| 960 | Some(recorded) |
| 961 | } |
| 962 | |
| 963 | fn build_linewise_crdt_ops_for_added_file( |
| 964 | path: &str, |
no test coverage detected