mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 12:38:43 +00:00
Fix reinstalling crates after removed by cargo-uninstall
(#628)
Honor `.crates.toml` only since `cargo-uninstall` can only update `.crates.toml`, not binstall's own manifest. Fixed #625 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
76e89f7b30
commit
cdff92aa3c
1 changed files with 5 additions and 12 deletions
|
@ -287,18 +287,11 @@ fn filter_out_installed_crates(
|
||||||
let name = &crate_name.name;
|
let name = &crate_name.name;
|
||||||
|
|
||||||
let curr_version = metadata
|
let curr_version = metadata
|
||||||
.and_then(|metadata| {
|
// `cargo-uninstall` can be called to uninstall crates,
|
||||||
metadata
|
// but it only updates .crates.toml.
|
||||||
.0
|
//
|
||||||
.get(name)
|
// So here we will honour .crates.toml only.
|
||||||
.map(|crate_info| &crate_info.current_version)
|
.and_then(|metadata| metadata.1.get(name));
|
||||||
.into_iter()
|
|
||||||
.chain(metadata.1.get(name))
|
|
||||||
// Since the cargo_install_v1_metadata could be out of sync
|
|
||||||
// from cargo_binstall_metadata, it is better to obtain
|
|
||||||
// the version from both of them and takes the larger one.
|
|
||||||
.max()
|
|
||||||
});
|
|
||||||
|
|
||||||
match (
|
match (
|
||||||
force,
|
force,
|
||||||
|
|
Loading…
Add table
Reference in a new issue