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

Function direct_target

atomic-repository/src/repository/projection_effects.rs:70–79  ·  view source on GitHub ↗
(oid: git2::Oid)

Source from the content-addressed store, hash-verified

68}
69
70fn direct_target(oid: git2::Oid) -> Result<GitRefTarget, RepositoryError> {
71 let algorithm = match oid.as_bytes().len() {
72 20 => atomic_core::operation::GitHashAlgorithm::Sha1,
73 32 => atomic_core::operation::GitHashAlgorithm::Sha256,
74 other => return Err(git_map(format!("unexpected Git OID width {other}"))),
75 };
76 let object = atomic_core::operation::GitObjectId::new(algorithm, oid.as_bytes().to_vec())
77 .map_err(|error| git_map(error.to_string()))?;
78 Ok(GitRefTarget::Direct(object))
79}
80
81fn read_ref(git: &GitRepository, name: &str) -> Result<Option<GitRefTarget>, RepositoryError> {
82 match git.find_reference(name) {

Callers

nothing calls this directly

Calls 3

git_mapFunction · 0.70
lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected