diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 5a201543af48..b021d23a0742 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -279,8 +279,7 @@ impl<'cfg> Source for GitSource<'cfg> { .join("checkouts") .join(&self.ident) .join(short_id.as_str()); - let parent_remote_url = self.url(); - db.copy_to(actual_rev, &checkout_path, self.config, parent_remote_url)?; + db.copy_to(actual_rev, &checkout_path, self.config)?; let source_id = self.source_id.with_precise(Some(actual_rev.to_string())); let path_source = PathSource::new_recursive(&checkout_path, source_id, self.config); diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 2c3ec86c12d9..47fb10111506 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -179,7 +179,6 @@ impl GitDatabase { rev: git2::Oid, dest: &Path, cargo_config: &Config, - parent_remote_url: &Url, ) -> CargoResult> { // If the existing checkout exists, and it is fresh, use it. // A non-fresh checkout can happen if the checkout operation was @@ -193,7 +192,7 @@ impl GitDatabase { Some(co) => co, None => GitCheckout::clone_into(dest, self, rev, cargo_config)?, }; - checkout.update_submodules(cargo_config, parent_remote_url)?; + checkout.update_submodules(cargo_config)?; Ok(checkout) } @@ -285,6 +284,11 @@ impl<'a> GitCheckout<'a> { } } + /// Gets the remote repository URL. + fn remote_url(&self) -> &Url { + &self.database.remote.url() + } + /// Clone a repo for a `revision` into a local path from a `datatabase`. /// This is a filesystem-to-filesystem clone. fn clone_into( @@ -392,8 +396,8 @@ impl<'a> GitCheckout<'a> { /// Submodules set to `none` won't be fetched. /// /// [^1]: - fn update_submodules(&self, cargo_config: &Config, parent_remote_url: &Url) -> CargoResult<()> { - return update_submodules(&self.repo, cargo_config, parent_remote_url); + fn update_submodules(&self, cargo_config: &Config) -> CargoResult<()> { + return update_submodules(&self.repo, cargo_config, self.remote_url()); /// Recusive helper for [`GitCheckout::update_submodules`]. fn update_submodules(