-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Multiple git dependencies with different refs confuses cargo #10256
Comments
I think this is a bug in pkgid specs, but otherwise this is valid and we should support this in Cargo. I think the lock files should work out alright in the sense that there are two nodes since the I think your suggestion about putting the rev in the url of the pkgid spec makes sense. (AFAIK this has been a bug since the beginning of pkgid specs, but pkgid specs never really took off in a big fashion either) |
Note that this can happen even if you have the same rev - cargo thinks that |
Another consequence of this is that cargo will think there's a linker conflict between the two versions, even if they point to the same git hash. # outer/Cargo.toml
[dependencies]
inner = { path = "./inner" }
boring-sys = { git = "https://github.com/cloudflare/boring", branch = "master" }
# inner/Cargo.toml
[dependencies]
boring-sys = { git = "https://github.com/cloudflare/boring", rev = "5f327aba86aab67af58f0db44e61d5b71b6eb84e" }
|
This can get as bad as making it impossible to update either of the conflicting dependency:
and produces an unactionable message. |
This also prevents running
|
A further issue: cargo considers |
Problem
If there are multiple git dependencies on the same repository with different refs, but those refs contain the same package version, then cargo gets confused. There is no package spec that can be passed to
-p
to unambiguously refer to them. Thus commands likecargo update -p my-git-dep
can't work.Steps
Example using cargo's testsuite:
Possible Solution(s)
I'm not sure if this should be an allowed configuration, since @alexcrichton has mentioned a few times like here that is an invalid Cargo.lock configuration. However, I think it probably should be supported, since otherwise it can make it hard to get all
Cargo.toml
files in sync.I could image cargo could allow pkgid specs of the form
https://.../foo.git?rev=499e8c4bb3b75ae6c4dcc91a8bdd81947c577147
or something like that.Notes
There are some related issues like #8101 and #8293, though I'm not sure if those are duplicates.
Version
The text was updated successfully, but these errors were encountered: