Fetch the RFC §8.6 binding/view namespaces from `remote` after the refspecs are configured. Plain `git clone` transfers only `refs/heads/*` (plus tags), so this explicit fetch is what carries the binding refs into a fresh clone.
(
git: &GitRepository,
remote: &str,
include_degraded: bool,
)
| 107 | /// `refs/heads/*` (plus tags), so this explicit fetch is what carries the |
| 108 | /// binding refs into a fresh clone. |
| 109 | pub(crate) fn fetch_binding_refs( |
| 110 | git: &GitRepository, |
| 111 | remote: &str, |
| 112 | include_degraded: bool, |
| 113 | ) -> CliResult<()> { |
| 114 | let workdir = git.workdir().ok_or_else(|| CliError::GitError { |
| 115 | message: "Git repository has no working directory".to_string(), |
| 116 | })?; |
| 117 | let mut spec = vec![ |
| 118 | super::transport::BINDING_REFSPEC.to_string(), |
| 119 | super::transport::VIEWS_REFSPEC.to_string(), |
| 120 | ]; |
| 121 | // CB-10B review R9: the degraded namespace is consumed ONLY behind the |
| 122 | // explicit degraded-reader opt-in, with the same fail-closed install |
| 123 | // validation the primary namespace runs. |
| 124 | if include_degraded { |
| 125 | spec.push(format!( |
| 126 | "+{}*:{}*", |
| 127 | super::transport::DEGRADED_HEAD_BINDING_PREFIX, |
| 128 | super::transport::DEGRADED_HEAD_BINDING_PREFIX |
| 129 | )); |
| 130 | } |
| 131 | let status = Command::new("git") |
| 132 | .args(["fetch", remote]) |
| 133 | .args(&spec) |
| 134 | .current_dir(workdir) |
| 135 | .status() |
| 136 | .map_err(|error| CliError::GitError { |
| 137 | message: format!("cannot run git fetch for binding refs: {error}"), |
| 138 | })?; |
| 139 | if !status.success() { |
| 140 | return Err(CliError::GitError { |
| 141 | message: format!( |
| 142 | "fetching binding refs from '{remote}' failed (exit {status}); the clone \ |
| 143 | cannot claim exact restoration without the binding namespace" |
| 144 | ), |
| 145 | }); |
| 146 | } |
| 147 | Ok(()) |
| 148 | } |
| 149 | |
| 150 | /// Install every fetched binding ref into the immutable local store after |
| 151 | /// full revalidation. Returns the number of newly stored bindings. |
no test coverage detected