Skip to content

Commit

Permalink
Reject ambiguous git dependency declaration.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Dec 16, 2020
1 parent de42302 commit d65a714
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
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

0 comments on commit d65a714

Please sign in to comment.