-
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
Cargo install -f --git doesn't update crate metadata #4582
Comments
Does this end up causing problems down the road? Or is this just a when-manually-inspected-it-looks-wrong bug? |
Yes, it does cause some minor annoyances. In nabijaczleweli/cargo-update#51 I asked for the cargo-update to be able to update git-installed binaries. When it updates them, it is not reflected in the metadata. So if the upstream git moves forward, it then updates every time even when it is no longer necessary. |
Definitely makes sense yeah, shouldn't be too hard to ensure we update it! |
Tracked it down to roughly these |
Related snippet: cargo/src/cargo/ops/cargo_install.rs Lines 359 to 362 in 695bc5e
cargo/src/cargo/core/source/source_id.rs Lines 451 to 453 in 695bc5e
More human friendly form:
Obviously it returns I see two possible solutions:
Before opening PR I'd like to hear which option seems better. |
I'm not him, but if I can offer my own humble opinion, option 2 looks both like less work and generally safer in the way the chance it breaks something else should be smaller. The only downside seems to be overwriting something when not strictly necessary, but this is not on any performance critical path, is it? |
@mati865 oh awesome thanks for tracking this down! Let's take the route of always replacing metadata, it's currently left out of |
Looks like it's not that easy to force replacing metadata. This approach however breaks 2 tests. |
@mati865 I think that patch may be removing too much by accident? I think that's deleting whole sets while we just want to replace keys, right? |
@alexcrichton we want to replace Replacing entries while keeping values would be great but it's |
Ah maybe we can just manfacture an entirely new map, favoring new keys over old ones? |
Always replace metadata when replacing package Fixes #4582 I'm having problem writing test for it. The test should install binary, make commit and reinstall binary, this part is done. To know if it was done properly we need to compare git revision of HEAD and installed binary and that's where the problems begin...
Hello
When I try to update a binary installed by cargo from git, it does so, but doesn't store the new git hash in cargo metadata.
This is in my
.cargo/.crates.toml
(just the relevant line):Now, I run cargo install:
As you can see, it shows a different hash. However, the line in the
crates.toml
file stays the same and the hash is not updated to reflect the newer version.If it is relevant, both commits contain the same package version (
v0.1.0
).The text was updated successfully, but these errors were encountered: