(
git_repo: &GitRepository,
tree_oid: git2::Oid,
publication: &VerifiedPublication,
)
| 1982 | } |
| 1983 | |
| 1984 | fn align_index_to_tree( |
| 1985 | git_repo: &GitRepository, |
| 1986 | tree_oid: git2::Oid, |
| 1987 | publication: &VerifiedPublication, |
| 1988 | ) -> CliResult<()> { |
| 1989 | if publication.git_tree_oid()? != tree_oid { |
| 1990 | return Err(git_error("refusing to align index to an unverified tree")); |
| 1991 | } |
| 1992 | let tree = git_repo.find_tree(tree_oid).map_err(|error| { |
| 1993 | git_error(format!( |
| 1994 | "cannot read shadow projection tree while aligning Git index: {error}" |
| 1995 | )) |
| 1996 | })?; |
| 1997 | let mut index = git_repo.index().map_err(|error| { |
| 1998 | git_error(format!( |
| 1999 | "cannot open Git index while aligning shadow view: {error}" |
| 2000 | )) |
| 2001 | })?; |
| 2002 | index |
| 2003 | .read_tree(&tree) |
| 2004 | .and_then(|_| index.write()) |
| 2005 | .map_err(|error| { |
| 2006 | git_error(format!( |
| 2007 | "cannot align Git index to the shadow projection tree: {error}" |
| 2008 | )) |
| 2009 | }) |
| 2010 | } |
| 2011 | |
| 2012 | fn snapshot_reference(git_repo: &GitRepository, name: &str) -> CliResult<ReferenceSnapshot> { |
| 2013 | match git_repo.find_reference(name) { |
nothing calls this directly
no test coverage detected