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

Function object_format_for

atomic-repository/src/repository/anchor.rs:448–456  ·  view source on GitHub ↗
(oid: &git2::Oid)

Source from the content-addressed store, hash-verified

446}
447
448fn object_format_for(oid: &git2::Oid) -> Result<GitObjectFormat, ShimAnchorError> {
449 match oid.as_bytes().len() {
450 20 => Ok(GitObjectFormat::Sha1),
451 32 => Ok(GitObjectFormat::Sha256),
452 other => Err(ShimAnchorError::Git(format!(
453 "unexpected Git OID width {other}"
454 ))),
455 }
456}
457
458fn tagged_oid(oid: &git2::Oid) -> Result<GitOid, ShimAnchorError> {
459 let bytes = oid.as_bytes();

Callers 1

build_anchor_bindingMethod · 0.85

Calls 3

GitClass · 0.85
lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected