| 1753 | } |
| 1754 | |
| 1755 | fn to_git2_oid(oid: &atomic_core::operation::GitObjectId) -> CliResult<git2::Oid> { |
| 1756 | use atomic_core::operation::GitHashAlgorithm; |
| 1757 | if oid.algorithm() != GitHashAlgorithm::Sha1 { |
| 1758 | return Err(git_error(format!( |
| 1759 | "libgit2 cannot address {:?} object ids", |
| 1760 | oid.algorithm() |
| 1761 | ))); |
| 1762 | } |
| 1763 | git2::Oid::from_bytes(oid.as_bytes()) |
| 1764 | .map_err(|error| git_error(format!("invalid projected Git oid: {error}"))) |
| 1765 | } |
| 1766 | |
| 1767 | /// The algorithm-tagged core identity of a libgit2 object id. |
| 1768 | fn to_core_oid(oid: git2::Oid) -> CliResult<atomic_core::operation::GitObjectId> { |