| 1941 | } |
| 1942 | |
| 1943 | fn to_git2_oid(oid: &atomic_core::operation::GitObjectId) -> CliResult<git2::Oid> { |
| 1944 | use atomic_core::operation::GitHashAlgorithm; |
| 1945 | if oid.algorithm() != GitHashAlgorithm::Sha1 { |
| 1946 | return Err(git_error(format!( |
| 1947 | "libgit2 cannot address {:?} object ids", |
| 1948 | oid.algorithm() |
| 1949 | ))); |
| 1950 | } |
| 1951 | git2::Oid::from_bytes(oid.as_bytes()) |
| 1952 | .map_err(|error| git_error(format!("invalid projected Git oid: {error}"))) |
| 1953 | } |
| 1954 | |
| 1955 | /// The algorithm-tagged core identity of a libgit2 object id. |
| 1956 | fn to_core_oid(oid: git2::Oid) -> CliResult<atomic_core::operation::GitObjectId> { |