MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / record_git_diff_add_fast

Function record_git_diff_add_fast

atomic-cli/src/commands/git/parallel.rs:934–961  ·  view source on GitHub ↗
(
    path: &str,
    new_content: &[u8],
    diff_lines: &[GitDiffLine],
    kind: atomic_core::record::workflow::DetectionKind,
)

Source from the content-addressed store, hash-verified

932}
933
934fn 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
963fn build_linewise_crdt_ops_for_added_file(
964 path: &str,

Callers 1

write_commitMethod · 0.85

Calls 8

set_contentMethod · 0.80
set_crdt_opsMethod · 0.80
set_crdt_statsMethod · 0.80
set_kindMethod · 0.45
set_encodingMethod · 0.45
add_hunkMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected