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>)
| 5281 | /// repository, with the same default (the configured default remote, else |
| 5282 | /// "origin") and the same not-found error. |
| 5283 | fn sync_resolve_remote(session: &Service, remote: &Option<String>) -> CliResult<(String, String)> { |
| 5284 | let response = session.list_remotes(pb::ListRemotesRequest { |
| 5285 | repository: Some(session.reference.clone()), |
| 5286 | })?; |
| 5287 | let name = match remote { |
| 5288 | Some(name) if !name.is_empty() => name.clone(), |
| 5289 | _ => response |
| 5290 | .remotes |
| 5291 | .iter() |
| 5292 | .find(|remote| remote.default) |
| 5293 | .map(|remote| remote.name.clone()) |
| 5294 | .unwrap_or_else(|| "origin".to_string()), |
| 5295 | }; |
| 5296 | if name.contains("://") { |
| 5297 | return Ok((name.clone(), name)); |
| 5298 | } |
| 5299 | match response.remotes.iter().find(|remote| remote.name == name) { |
| 5300 | Some(entry) => Ok((name, entry.url.clone())), |
| 5301 | None => Err(CliError::RemoteNotFound { name }), |
| 5302 | } |
| 5303 | } |
| 5304 | |
| 5305 | /// The client-side auth headers: the SAME attach_identity resolution the |
| 5306 | /// local bodies run (identity store + config reads + token minting — none |
no test coverage detected