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

Function resolve_by_hex

atomic-cli/src/commands/git/binding.rs:609–628  ·  view source on GitHub ↗
(repo: &Repository, id: &str)

Source from the content-addressed store, hash-verified

607}
608
609fn resolve_by_hex(repo: &Repository, id: &str) -> CliResult<GitStateBinding> {
610 let ids = repo.binding_ids().map_err(CliError::from)?;
611 for candidate in ids {
612 if candidate.to_hex() == id.to_ascii_lowercase() {
613 return repo
614 .load_binding(&candidate)
615 .map_err(CliError::from)?
616 .ok_or_else(|| {
617 CliError::Repository(atomic_repository::RepositoryError::InvalidOperation {
618 message: format!("binding {id} not stored"),
619 })
620 });
621 }
622 }
623 Err(CliError::Repository(
624 atomic_repository::RepositoryError::InvalidOperation {
625 message: format!("binding {id} is not stored locally"),
626 },
627 ))
628}
629
630fn resolve_by_prefix(repo: &Repository, prefix: &str) -> CliResult<GitStateBinding> {
631 let lower = prefix.to_ascii_lowercase();

Callers 1

verifyFunction · 0.85

Calls 4

RepositoryClass · 0.85
binding_idsMethod · 0.80
load_bindingMethod · 0.80
to_hexMethod · 0.45

Tested by

no test coverage detected