Resolve the remote name + URL through the service layer's ListRemotes read — the same domain lookup the local bodies perform over the repository, with the same default (the configured default remote, else "origin") and the same not-found error.
(session: &Service, remote: &Option<String>)
| 5241 | /// repository, with the same default (the configured default remote, else |
| 5242 | /// "origin") and the same not-found error. |
| 5243 | fn sync_resolve_remote(session: &Service, remote: &Option<String>) -> CliResult<(String, String)> { |
| 5244 | let response = session.list_remotes(pb::ListRemotesRequest { |
| 5245 | repository: Some(session.reference.clone()), |
| 5246 | })?; |
| 5247 | let name = match remote { |
| 5248 | Some(name) if !name.is_empty() => name.clone(), |
| 5249 | _ => response |
| 5250 | .remotes |
| 5251 | .iter() |
| 5252 | .find(|remote| remote.default) |
| 5253 | .map(|remote| remote.name.clone()) |
| 5254 | .unwrap_or_else(|| "origin".to_string()), |
| 5255 | }; |
| 5256 | if name.contains("://") { |
| 5257 | return Ok((name.clone(), name)); |
| 5258 | } |
| 5259 | match response.remotes.iter().find(|remote| remote.name == name) { |
| 5260 | Some(entry) => Ok((name, entry.url.clone())), |
| 5261 | None => Err(CliError::RemoteNotFound { name }), |
| 5262 | } |
| 5263 | } |
| 5264 | |
| 5265 | /// The client-side auth headers: the SAME attach_identity resolution the |
| 5266 | /// local bodies run (identity store + config reads + token minting — none |
no test coverage detected