Build the preferred Atomic-remote closure source, when one is configured.
(
repo: &Repository,
remote: Option<&str>,
timeout: u64,
insecure: bool,
)
| 877 | |
| 878 | /// Build the preferred Atomic-remote closure source, when one is configured. |
| 879 | fn build_remote_source( |
| 880 | repo: &Repository, |
| 881 | remote: Option<&str>, |
| 882 | timeout: u64, |
| 883 | insecure: bool, |
| 884 | ) -> CliResult<Option<HttpBindingChangeSource>> { |
| 885 | match remote { |
| 886 | Some(remote) => { |
| 887 | let url = if remote.contains("://") { |
| 888 | remote.to_string() |
| 889 | } else { |
| 890 | repo.get_remote(remote) |
| 891 | .map(|entry| entry.url) |
| 892 | .map_err(CliError::Repository)? |
| 893 | }; |
| 894 | println!("Atomic remote preferred for closure objects: {url}"); |
| 895 | let config = atomic_remote::HttpRemoteConfig::new() |
| 896 | .with_timeout(std::time::Duration::from_secs(timeout)) |
| 897 | .danger_accept_invalid_certs(insecure); |
| 898 | Ok(Some(HttpBindingChangeSource { |
| 899 | remote: atomic_remote::HttpRemote::with_config(&url, config) |
| 900 | .map_err(|error| git_map(error.to_string()))?, |
| 901 | })) |
| 902 | } |
| 903 | None => Ok(None), |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | /// `atomic git shim binding resurrect` (CB-6C): exact restoration of a |
| 908 | /// verified binding's closure into a view. |
no test coverage detected