-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unable to cargo update git dependency with two branches used at the same time #8481
Comments
Thanks for the report! Package ID specs are kinda wonky right now (#7725). I'm actually not really sure how this should work. It looks like this behavior dates back to the introduction of specs (#618). Just some rough thoughts:
Tagged with command-pkgid since that's the only label related to specs. |
One problem is that it's very unclear why that happens at all. Until I tried to make a minimal repro, I had no idea what caused this. It seemed like it just randomly errors out sometimes. So just fixing the error message would already be good. |
I'm getting that issue when upgrading some dependency in a project I'm on. Any idea about how I can update that dependency? EDIT: I've found by myself. That happened after doing this:
After just reverting the changes in |
It would be a big improvement if the error message indicated how the ambiguous package was being pulled in e.g. for the example workspace for this issue
|
fwiw - with the example workspace w1.zip and
In general though, this problem can still occur, e.g. if in rand = { git = "https://github.com/rust-random/rand.git", tag = "0.8.5" } and in rand = { git = "https://github.com/rust-random/rand.git", rev = "937320cbfeebd4352a23086d9c6e68f067f74644" } Here, tag
The underlying issue is that both of those rand dependencies as specified result in the same package ID spec ( |
I tried to reproduce this [package]
name = "cargo-8481"
version = "0.1.0"
edition = "2021"
[dependencies]
rand1 = { git = "https://github.com/rust-random/rand.git", rev = "937320c", package = "rand" }
rand2 = { git = "https://github.com/rust-random/rand.git", branch = "0.8", package = "rand" } $ cargo update rand
warning: ignoring `resolver` config table without `-Zmsrv-policy`
error: There are multiple `rand` packages in your project, and the specification `rand` is ambiguous.
Please re-run this command with one of the following specifications:
git+https://github.com/rust-random/rand.git?branch=0.8#[email protected]
git+https://github.com/rust-random/rand.git?rev=937320c#[email protected]
$ cargo update git+https://github.com/rust-random/rand.git?branch=0.8#[email protected]
warning: ignoring `resolver` config table without `-Zmsrv-policy`
Updating git repository `https://github.com/rust-random/rand.git`
Updating crates.io index
Locking 0 packages to latest compatible versions Looks like this was resolved by #12933. |
Problem
cargo update -p package
doesn't work and produces a non-working suggestion.Steps
Workspace archive attached for convenience: w1.zip
lib1
andlib2
.lib1
:rand = { git = "https://github.com/rust-random/rand.git" }
lib2
:rand = { git = "https://github.com/rust-random/rand.git", branch = "0.7" }
cargo check
or anything that generates a lock file.cargo update -p rand
. Output:cargo update -p 'https://github.com/rust-random/rand.git#rand:0.7.4'
There should be a way to disambiguate between these packages.
Notes
Output of
cargo version
:cargo 1.44.1 (88ba85757 2020-06-11)
The text was updated successfully, but these errors were encountered: