MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / to_git2_oid

Function to_git2_oid

atomic-cli/src/commands/git/shadow.rs:1943–1953  ·  view source on GitHub ↗
(oid: &atomic_core::operation::GitObjectId)

Source from the content-addressed store, hash-verified

1941}
1942
1943fn 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.
1956fn to_core_oid(oid: git2::Oid) -> CliResult<atomic_core::operation::GitObjectId> {

Callers

nothing calls this directly

Calls 3

git_errorFunction · 0.70
algorithmMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected