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

Function crash_span_entry

atomic-repository/src/repository/git_stream.rs:1311–1355  ·  view source on GitHub ↗
(
        seed: u8,
        parent: Option<u8>,
        path: &str,
        bytes: &[u8],
        project: &ProjectTree,
        dependency: Option<Hash>,
    )

Source from the content-addressed store, hash-verified

1309
1310 #[cfg(unix)]
1311 fn crash_span_entry(
1312 seed: u8,
1313 parent: Option<u8>,
1314 path: &str,
1315 bytes: &[u8],
1316 project: &ProjectTree,
1317 dependency: Option<Hash>,
1318 ) -> PreparedGitGraphChange {
1319 use atomic_core::change::span_patch::{SpanOp, SpanPatch};
1320 let mut change = entry(seed, parent, path, bytes, project, false).change;
1321 change.hashed.header.timestamp =
1322 chrono::DateTime::from_timestamp(1_700_000_000, 0).unwrap();
1323 change.hashed.dependencies = dependency.into_iter().collect();
1324 let (start, end) = match &mut change.hashed.hunks[0] {
1325 GraphOp::FileAdd { contents, .. } => {
1326 let content = contents.take().unwrap();
1327 (content.start.get(), content.end.get())
1328 }
1329 _ => panic!("expected file addition"),
1330 };
1331 change.hashed.span = Some(SpanPatch::new(
1332 Vec::new(),
1333 vec![SpanOp::Root {
1334 path: path.into(),
1335 ordinal: 0,
1336 start,
1337 end,
1338 }],
1339 ));
1340 let oid = |value| GitObjectId::new(GitHashAlgorithm::Sha1, vec![value; 20]).unwrap();
1341 let origin = match parent {
1342 Some(parent) => {
1343 GitSynthesisOrigin::first_parent(oid(seed), project.git.root.clone(), oid(parent))
1344 }
1345 None => GitSynthesisOrigin::root(oid(seed), project.git.root.clone()),
1346 }
1347 .unwrap();
1348 PreparedGitGraphChange::new_span(
1349 change,
1350 origin.clone(),
1351 b"incremental crash fixture".to_vec(),
1352 crate::git_synthesis_metadata(&origin, &[], None),
1353 )
1354 .unwrap()
1355 }
1356
1357 #[cfg(unix)]
1358 fn crash_baseline_project() -> (ProjectTree, VerifiedProspectiveEquivalence) {

Calls 9

rootFunction · 0.85
git_synthesis_metadataFunction · 0.85
entryFunction · 0.70
oidFunction · 0.70
getMethod · 0.65
unwrapMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45