| 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) { |