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

Method new

atomic-repository/src/repository/tests/synthesis_tests.rs:1827–1863  ·  view source on GitHub ↗
(binary: bool)

Source from the content-addressed store, hash-verified

1825
1826impl CorruptedBase {
1827 fn new(binary: bool) -> Self {
1828 let directory = TempDir::new().unwrap();
1829 let repo = Repository::init(directory.path()).unwrap();
1830 let f_bytes: &[u8] = if binary {
1831 &[0, 1, 2, 3]
1832 } else {
1833 b"inherited text\n"
1834 };
1835 let recorded: Vec<RecordedFile> = [("f.txt", f_bytes), ("g.txt", &b"other\n"[..])]
1836 .iter()
1837 .map(|(path, bytes)| memory_add(path, bytes))
1838 .collect();
1839 let origin = GitSynthesisOrigin::root(oid20(0x31), oid20(0x32)).expect("root origin");
1840 let unhashed = crate::git_synthesis_metadata(&origin, &[], None);
1841 let expectation = full_tree_expectation(
1842 &[("f.txt", f_bytes), ("g.txt", b"other\n")],
1843 &["f.txt", "g.txt"],
1844 );
1845 repo.synthesize_git_change(
1846 fixed_header("import base"),
1847 &recorded,
1848 origin,
1849 unhashed,
1850 Vec::new(),
1851 &[],
1852 false,
1853 &empty_verification(),
1854 InsertOptions::default(),
1855 &[],
1856 &expectation,
1857 None,
1858 &[],
1859 &[],
1860 )
1861 .expect("publish the base");
1862 Self { directory, repo }
1863 }
1864
1865 /// Synthesize the g.txt successor and require the typed refusal.
1866 /// `f_bytes` is the untouched inherited content of f.txt.

Callers

nothing calls this directly

Calls 13

memory_addFunction · 0.85
rootFunction · 0.85
oid20Function · 0.85
git_synthesis_metadataFunction · 0.85
full_tree_expectationFunction · 0.85
empty_verificationFunction · 0.85
synthesize_git_changeMethod · 0.80
fixed_headerFunction · 0.70
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected