(binary: bool)
| 1825 | |
| 1826 | impl 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. |
nothing calls this directly
no test coverage detected