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

Function assert_raw_history

atomic-cli/src/commands/git/stream.rs:1335–1401  ·  view source on GitHub ↗
(git: &GitRepository, tips: &[Oid])

Source from the content-addressed store, hash-verified

1333 }
1334
1335 fn assert_raw_history(git: &GitRepository, tips: &[Oid]) {
1336 let policy = conversion_policy(git).unwrap();
1337 for tip in tips {
1338 let mut state = None;
1339 for (batch, rolling) in [(1, false), (100, false), (100, true)] {
1340 let output = tempfile::tempdir().unwrap();
1341 let mut repo = Repository::init(output.path()).unwrap();
1342 let importer = ParallelImporter::new(
1343 git,
1344 ParallelImportOptions {
1345 graph_only: true,
1346 target_view: repo.current_view().into(),
1347 ..Default::default()
1348 },
1349 );
1350 let limits = GitStreamLimits::new(batch, 32 * 1024 * 1024).unwrap();
1351 let outcome = if rolling {
1352 let (_, _, ordered) = importer.graph_stream_inputs(*tip).unwrap();
1353 importer.import_graph_stream_rolling(&mut repo, *tip, limits, &ordered)
1354 } else {
1355 importer.import_graph_stream(&mut repo, *tip, limits)
1356 }
1357 .unwrap_or_else(|error| {
1358 panic!("tip {tip}, batch {batch}, rolling {rolling}: {error}")
1359 });
1360 for entry in repo.effective_history(None).unwrap() {
1361 assert!(repo.load_change(&entry.hash).unwrap().file_ops().is_empty());
1362 }
1363 if let Some(state) = state {
1364 assert_eq!(outcome.state, state, "batch size changed identity at {tip}");
1365 } else {
1366 state = Some(outcome.state);
1367 }
1368 let source = git.find_commit(*tip).unwrap().tree_id();
1369 let actual = repo.project_tree(repo.current_view(), &policy).unwrap();
1370 assert_eq!(
1371 actual.git.root.as_bytes(),
1372 source.as_bytes(),
1373 "raw Git tree bytes must survive at {tip} on every host"
1374 );
1375 // Recorded projection never materializes native paths. Exercise
1376 // non-Unix capabilities on Unix too, retaining exact path, mode,
1377 // kind and content identity even for unrepresentable filenames.
1378 let mut non_unix_policy = policy.clone();
1379 non_unix_policy.platform.lossless_unix_paths = false;
1380 let portable = repo
1381 .project_tree(repo.current_view(), &non_unix_policy)
1382 .unwrap();
1383 assert_eq!(portable.git.root.as_bytes(), source.as_bytes());
1384 assert_eq!(portable.manifest.entries, actual.manifest.entries);
1385 // The physical boundary remains unsupported: successful graph
1386 // projection must not imply native path or shim capabilities.
1387 let filter =
1388 atomic_repository::GitAttributesFilter::new(output.path(), Default::default());
1389 assert!(matches!(
1390 atomic_repository::observe_worktree(
1391 output.path(),
1392 None,

Calls 11

conversion_policyFunction · 0.85
graph_stream_inputsMethod · 0.80
import_graph_streamMethod · 0.80
effective_historyMethod · 0.80
project_treeMethod · 0.80
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
current_viewMethod · 0.45
cloneMethod · 0.45