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

Function import

atomic-cli/tests/it/git_import_path_audit_test.rs:48–82  ·  view source on GitHub ↗
(root: &Path, git: &GitRepository, tip: Oid, config: &Path)

Source from the content-addressed store, hash-verified

46}
47
48fn import(root: &Path, git: &GitRepository, tip: Oid, config: &Path) {
49 git.reference("refs/heads/main", tip, true, "fixture")
50 .unwrap();
51 git.set_head("refs/heads/main").unwrap();
52 git.checkout_head(Some(git2::build::CheckoutBuilder::new().force()))
53 .unwrap();
54 let mut command = Command::new(
55 std::env::var("ATOMIC_AUDIT_BINARY")
56 .unwrap_or_else(|_| env!("CARGO_BIN_EXE_atomic").to_string()),
57 );
58 for (key, _) in std::env::vars().filter(|(key, _)| key.starts_with("ATOMIC_")) {
59 command.env_remove(key);
60 }
61 let output = command
62 .current_dir(root)
63 .env("ATOMIC_CONFIG_DIR", config)
64 .env("ATOMIC_SERVICE", "local")
65 .env("ATOMIC_NONINTERACTIVE", "1")
66 .args(["git", "import", "--no-vault", "--no-color"])
67 .args(
68 std::env::var("ATOMIC_AUDIT_FLAGS")
69 // The full path/type corpus targets the ordinary importer;
70 // an explicit audit override can still select --stream.
71 .unwrap_or_else(|_| "--no-stream".into())
72 .split_whitespace(),
73 )
74 .output()
75 .unwrap();
76 assert!(
77 output.status.success(),
78 "import failed:\n{}\n{}",
79 String::from_utf8_lossy(&output.stdout),
80 String::from_utf8_lossy(&output.stderr)
81 );
82}
83
84fn check_case(states: Vec<Vec<(&str, &[u8], i32)>>, merge: bool) {
85 let root = tempfile::tempdir().unwrap();

Calls 4

referenceMethod · 0.80
forceMethod · 0.80
unwrapMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected