pub fn open(repository_config: &RepositoryConfig) -> anyhow::Result<Self> {
        let checkout_path = tempfile::Builder::new()
            .prefix("git")
            .tempdir()
            .context("Failed to create temporary directory")?;

        let repository = git2::build::RepoBuilder::new()
            .fetch_options(Self::fetch_options(&repository_config.credentials))
            .remote_create(|repo, name, url| {
                // Manually create the remote with a fetchspec, to avoid cloning old snaphots
                repo.remote_with_fetch(
                    name,
                    url,
                    &format!("+refs/heads/master:refs/remotes/{name}/master"),
                )
            })
            .clone(
                repository_config.index_location.as_str(),
                checkout_path.path(),
            )
            .context("Failed to clone index repository")?;

        // All commits to the index registry made through crates.io will be made by bors, the Rust
        // community's friendly GitHub bot.

        let mut cfg = repository
            .config()
            .context("Failed to read git configuration")?;

        cfg.set_str("user.name", "bors")
            .context("Failed to set user name")?;

        cfg.set_str("user.email", "bors@rust-lang.org")
            .context("Failed to set user email address")?;

        Ok(Self {
            checkout_path,
            repository,
            credentials: repository_config.credentials.clone(),
        })
    }
/// Clones the crate index from a remote git server and returns a
/// `Repository` struct to interact with the local copy of the crate index.
///
/// Note that the `user` configuration for the repository is automatically
/// set to `bors <bors@rust-lang.org>`.
///
/// # Errors
///
/// - If creation of a temporary folder for cloning the crate index fails.
/// - If cloning the crate index fails.
/// - If reading the global git config fails.
///
Clones the crate index from a remote git server and returns a
`Repository` struct to interact with the local copy of the crate index.

Note that the `user` configuration for the repository is automatically
set to `bors `.
Clones the crate index from a remote git server and returns a ` Repository ` struct to interact with the local copy of the crate index . Note that the ` user ` configuration for the repository is automatically set to ` bors ` .
pub fn open(repository_config: &RepositoryConfig) -> anyhow::Result<Self> {
        let checkout_path = tempfile::Builder::new()
            .prefix("git")
            .tempdir()
            .context("Failed to create temporary directory")?;
        let repository = git2::build::RepoBuilder::new()
            .fetch_options(Self::fetch_options(&repository_config.credentials))
            .remote_create(|repo, name, url| {
                // Manually create the remote with a fetchspec, to avoid cloning old snaphots
                repo.remote_with_fetch(
                    name,
                    url,
                    &format!("+refs/heads/master:refs/remotes/{name}/master"),
                )
            })
            .clone(
                repository_config.index_location.as_str(),
                checkout_path.path(),
            )
            .context("Failed to clone index repository")?;
        // All commits to the index registry made through crates.io will be made by bors, the Rust
        // community's friendly GitHub bot.
        let mut cfg = repository
            .config()
            .context("Failed to read git configuration")?;
        cfg.set_str("user.name", "bors")
            .context("Failed to set user name")?;
        cfg.set_str("user.email", "bors@rust-lang.org")
            .context("Failed to set user email address")?;
        Ok(Self {
            checkout_path,
            repository,
            credentials: repository_config.credentials.clone(),
        })
    }
pub fn open ( repository_config : & RepositoryConfig ) -> anyhow :: Result < Self > { let checkout_path = tempfile :: Builder :: new ( ) . prefix ( " " ) . tempdir ( ) . context ( " " ) ? ; let repository = git2 :: build :: RepoBuilder :: new ( ) . fetch_options ( Self :: fetch_options ( & repository_config . credentials ) ) . remote_create ( | repo , name , url | { // Manually create the remote with a fetchspec, to avoid cloning old snaphots repo . remote_with_fetch ( name , url , & format ! ( " " ) , ) } ) . clone ( repository_config . index_location . as_str ( ) , checkout_path . path ( ) , ) . context ( " " ) ? ; // All commits to the index registry made through crates.io will be made by bors, the Rust // community's friendly GitHub bot. let mut cfg = repository . config ( ) . context ( " " ) ? ; cfg . set_str ( " " , " " ) . context ( " " ) ? ; cfg . set_str ( " " , " " ) . context ( " " ) ? ; Ok ( Self { checkout_path , repository , credentials : repository_config . credentials . clone ( ) , } ) }
Clones the crate index from a remote git server and returns a
`Repository` struct to interact with the local copy of the crate index.
Clones the crate index from a remote git server and returns a ` Repository ` struct to interact with the local copy of the crate index .
repository_config
&RepositoryConfig
errors
If creation of a temporary folder for cloning the crate index fails.
If cloning the crate index fails.
If reading the global git config fails.
If creation of a temporary folder for cloning the crate index fails . If cloning the crate index fails . If reading the global git config fails .