MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_remote_source

Function build_remote_source

atomic-cli/src/commands/git/binding.rs:879–905  ·  view source on GitHub ↗

Build the preferred Atomic-remote closure source, when one is configured.

(
    repo: &Repository,
    remote: Option<&str>,
    timeout: u64,
    insecure: bool,
)

Source from the content-addressed store, hash-verified

877
878/// Build the preferred Atomic-remote closure source, when one is configured.
879fn 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.

Callers 2

fetchFunction · 0.85
resurrectFunction · 0.85

Calls 5

git_mapFunction · 0.70
containsMethod · 0.45
get_remoteMethod · 0.45
with_timeoutMethod · 0.45

Tested by

no test coverage detected