-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #4957 - sfackler:registry-elaboration, r=alexcrichton
Elaborate registry names to index URLs when publishing This avoids introducing a dependency on the publisher's name for the registry. Closes #4880
- Loading branch information
Showing
6 changed files
with
117 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ extern crate hamcrest; | |
|
||
use cargotest::ChannelChanger; | ||
use cargotest::support::registry::{self, Package, alt_api_path}; | ||
use cargotest::support::{project, execs}; | ||
use cargotest::support::{paths, project, execs}; | ||
use hamcrest::assert_that; | ||
use std::fs::File; | ||
use std::io::Write; | ||
|
||
#[test] | ||
fn is_feature_gated() { | ||
|
@@ -423,3 +425,35 @@ fn publish_with_crates_io_dep() { | |
.arg("--registry").arg("alternative").arg("-Zunstable-options"), | ||
execs().with_status(0)); | ||
} | ||
|
||
#[test] | ||
fn credentials_in_url_forbidden() { | ||
registry::init(); | ||
|
||
let config = paths::home().join(".cargo/config"); | ||
|
||
File::create(config) | ||
.unwrap() | ||
.write_all(br#" | ||
[registries.alternative] | ||
index = "ssh://git:[email protected]" | ||
"#) | ||
.unwrap(); | ||
|
||
let p = project("foo") | ||
.file("Cargo.toml", r#" | ||
cargo-features = ["alternative-registries"] | ||
[project] | ||
name = "foo" | ||
version = "0.0.1" | ||
authors = [] | ||
"#) | ||
.file("src/main.rs", "fn main() {}") | ||
.build(); | ||
|
||
assert_that(p.cargo("publish").masquerade_as_nightly_cargo() | ||
.arg("--registry").arg("alternative").arg("-Zunstable-options"), | ||
execs().with_status(101) | ||
.with_stderr_contains("error: Registry URLs may not contain credentials")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters