Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/cargo/util/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ pub fn registry_credential_config(
secret_key_subject: Option<String>,
#[serde(rename = "default")]
_default: Option<String>,
#[serde(rename = "protocol")]
_protocol: Option<String>,
Comment on lines +136 to +137
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something we can do to avoid running into this issue in the future?

}

log::trace!("loading credential config for {}", sid);
Expand Down
27 changes: 27 additions & 0 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,33 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN",
.run();
}

#[cargo_test]
fn cargo_registries_crates_io_protocol() {
let _ = RegistryBuilder::new()
.no_configure_token()
.alternative()
.build();
// Should not produce a warning due to the registries.crates-io.protocol = 'sparse' configuration
let p = project()
.file("src/lib.rs", "")
.file(
".cargo/config.toml",
"[registries.crates-io]
protocol = 'sparse'",
)
.build();

p.cargo("publish --registry alternative")
.with_status(101)
.with_stderr(
"\
[UPDATING] `alternative` index
error: no token found for `alternative`, please run `cargo login --registry alternative`
or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN",
)
.run();
}

#[cargo_test]
fn publish_to_alt_registry() {
let _reg = RegistryBuilder::new()
Expand Down