(
git_repo: &GitRepository,
tree_oid: git2::Oid,
publication: &VerifiedPublication,
)
| 1794 | } |
| 1795 | |
| 1796 | fn align_index_to_tree( |
| 1797 | git_repo: &GitRepository, |
| 1798 | tree_oid: git2::Oid, |
| 1799 | publication: &VerifiedPublication, |
| 1800 | ) -> CliResult<()> { |
| 1801 | if publication.git_tree_oid()? != tree_oid { |
| 1802 | return Err(git_error("refusing to align index to an unverified tree")); |
| 1803 | } |
| 1804 | let tree = git_repo.find_tree(tree_oid).map_err(|error| { |
| 1805 | git_error(format!( |
| 1806 | "cannot read shadow projection tree while aligning Git index: {error}" |
| 1807 | )) |
| 1808 | })?; |
| 1809 | let mut index = git_repo.index().map_err(|error| { |
| 1810 | git_error(format!( |
| 1811 | "cannot open Git index while aligning shadow view: {error}" |
| 1812 | )) |
| 1813 | })?; |
| 1814 | index |
| 1815 | .read_tree(&tree) |
| 1816 | .and_then(|_| index.write()) |
| 1817 | .map_err(|error| { |
| 1818 | git_error(format!( |
| 1819 | "cannot align Git index to the shadow projection tree: {error}" |
| 1820 | )) |
| 1821 | }) |
| 1822 | } |
| 1823 | |
| 1824 | fn snapshot_reference(git_repo: &GitRepository, name: &str) -> CliResult<ReferenceSnapshot> { |
| 1825 | match git_repo.find_reference(name) { |
nothing calls this directly
no test coverage detected