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:1047–1074  ·  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

1045}
1046
1047fn 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
1076fn build_linewise_crdt_ops_for_added_file(
1077 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