Resolve the identity name to authenticate as. Priority: 1. An explicit override (the `--identity` flag). 2. URL userinfo (`http://bob@host/...`). 3. A configured server profile whose host is the longest dot-boundary suffix of the remote host (`[servers.prod] url=... identity=...`). This is the binding that makes pushes to *any* tenant under a server you've registered with ("just works" without `-
(
remote_url: &str,
identity_override: Option<&str>,
)
| 40 | /// Returns `None` only when there is no override and nothing inferable from the |
| 41 | /// URL or config. |
| 42 | fn resolve_identity_name_with_override( |
| 43 | remote_url: &str, |
| 44 | identity_override: Option<&str>, |
| 45 | ) -> Option<String> { |
| 46 | if let Some(name) = identity_override { |
| 47 | return Some(name.to_string()); |
| 48 | } |
| 49 | resolve_identity_from_url(remote_url, &configured_server_identities()) |
| 50 | } |
| 51 | |
| 52 | /// Collect `(server_host, identity)` pairs from the global config — both the |
| 53 | /// default `[server]` block and every named `[servers.*]` profile — that |