Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a Source::parse arm for sparse repos (keeping it in the scheme). … #2950

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions crate_universe/src/metadata/cargo_tree_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ impl Source {
let original_scheme = url.scheme().to_owned();
let scheme_parts: Vec<_> = original_scheme.split('+').collect();
match &scheme_parts[..] {
// e.g. sparse+https://github.com/rust-lang/crates.io-index
["sparse", _] => Ok(Self::Registry {
registry: url.to_string(),
version,
}),
// e.g. registry+https://github.com/rust-lang/crates.io-index
["registry", scheme] => {
let new_url = set_url_scheme_despite_the_url_crate_not_wanting_us_to(&url, scheme)?;
Expand Down Expand Up @@ -936,6 +941,25 @@ mod test {

use super::*;

#[test]
fn parse_sparse_source() {
let source = Source::parse(
"sparse+https://github.com/rust-lang/crates.io-index",
"1.0.1".to_owned(),
)
.unwrap();
// sparse we want to leave the augmented scheme in there.
// cargo_toml::RegistryDetail::registry_index explicitly supports
illicitonion marked this conversation as resolved.
Show resolved Hide resolved
// sparse+https:
assert_eq!(
source,
Source::Registry {
registry: "sparse+https://github.com/rust-lang/crates.io-index".to_owned(),
version: "1.0.1".to_owned()
}
);
}

#[test]
fn parse_registry_source() {
let source = Source::parse(
Expand Down
Loading