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

Function install_degraded_bindings

atomic-cli/src/commands/git/bootstrap.rs:168–194  ·  view source on GitHub ↗

CB-10B review R9: the DEGRADED namespace (`refs/heads/atomic/bindings/*`) installs through the SAME fail-closed validation as the primary namespace — decode, canonical ref id, cryptography, live Git content, exact immutable carrier — only behind the explicit degraded-reader opt-in.

(
    repo: &Repository,
    git: &GitRepository,
)

Source from the content-addressed store, hash-verified

166/// exact immutable carrier — only behind the explicit degraded-reader
167/// opt-in.
168pub(crate) fn install_degraded_bindings(
169 repo: &Repository,
170 git: &GitRepository,
171) -> CliResult<usize> {
172 use atomic_repository::git_binding::DEGRADED_HEAD_BINDING_PREFIX;
173 let mut names = Vec::new();
174 for reference in git.references().map_err(|error| CliError::GitError {
175 message: format!("cannot enumerate refs: {error}"),
176 })? {
177 let reference = reference.map_err(|error| CliError::GitError {
178 message: format!("cannot read ref: {error}"),
179 })?;
180 let Ok(name) = reference.name() else {
181 continue;
182 };
183 if let Some(rest) = name.strip_prefix(DEGRADED_HEAD_BINDING_PREFIX) {
184 let mut parts = rest.split('/');
185 let shard = parts.next().unwrap_or("");
186 let id_hex = parts.next().unwrap_or("");
187 if parts.next().is_none() && shard.len() == 2 && id_hex.len() == 64 {
188 names.push(name.to_string());
189 }
190 }
191 }
192 names.sort();
193 install_binding_refs(repo, git, names)
194}
195
196/// The shared fail-closed binding install over an explicit ref-name list.
197fn install_binding_refs(

Callers 1

adopt_git_checkoutFunction · 0.85

Calls 7

install_binding_refsFunction · 0.85
is_noneMethod · 0.80
sortMethod · 0.80
nameMethod · 0.45
nextMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected