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

Reject ambiguous git dependency declaration. #8984

Merged
merged 1 commit into from
Dec 16, 2020
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
6 changes: 2 additions & 4 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,13 +1692,11 @@ impl DetailedTomlDependency {
.count();

if n_details > 1 {
let msg = format!(
bail!(
"dependency ({}) specification is ambiguous. \
Only one of `branch`, `tag` or `rev` is allowed. \
This will be considered an error in future versions",
Only one of `branch`, `tag` or `rev` is allowed.",
name_in_toml
);
cx.warnings.push(msg)
}

let reference = self
Expand Down
9 changes: 5 additions & 4 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,12 @@ fn ambiguous_git_reference() {

p.cargo("build -v")
.with_status(101)
.with_stderr_contains(
.with_stderr(
"\
[WARNING] dependency (bar) specification is ambiguous. \
Only one of `branch`, `tag` or `rev` is allowed. \
This will be considered an error in future versions
[ERROR] failed to parse manifest at `[..]`

Caused by:
dependency (bar) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed.
",
)
.run();
Expand Down