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

Function canonical_ref_target

atomic-cli/src/commands/git/shim.rs:167–177  ·  view source on GitHub ↗
(oid: Oid)

Source from the content-addressed store, hash-verified

165}
166
167fn canonical_ref_target(oid: Oid) -> Option<GitRefTarget> {
168 let bytes = oid.as_bytes().to_vec();
169 let algorithm = match bytes.len() {
170 20 => GitHashAlgorithm::Sha1,
171 32 => GitHashAlgorithm::Sha256,
172 _ => return None,
173 };
174 GitObjectId::new(algorithm, bytes)
175 .ok()
176 .map(GitRefTarget::Direct)
177}
178
179/// Journal an expected-absent ref creation, perform it through a real Git
180/// reference transaction, then record its leased receipt and verify.

Callers

nothing calls this directly

Calls 3

as_bytesMethod · 0.45
lenMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected