Skip to content

Commit

Permalink
Dedup the same version binaries
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Oct 27, 2023
1 parent 397f446 commit 731ae05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use cargo::util::IntoUrl;
use cargo::util::ToSemver;
use cargo::util::VersionReqExt;
use cargo::CargoResult;
use itertools::Itertools;
use semver::VersionReq;

use cargo_util::paths;
Expand Down Expand Up @@ -119,6 +120,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
.get_many::<CrateVersion>("crate")
.unwrap_or_default()
.cloned()
.dedup_by(|x, y| x == y)
.map(|(krate, local_version)| resolve_crate(krate, local_version, version))
.collect::<crate::CargoResult<Vec<_>>>()?;

Expand Down
6 changes: 0 additions & 6 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ fn install_the_same_version_twice() {
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
[FINISHED] release [optimized] target(s) in [..]
[REPLACING] [CWD]/home/.cargo/bin/foo[EXE]
[REPLACED] package `foo v0.0.1` with `foo v0.0.1` (executable `foo[EXE]`)
Summary Successfully installed foo, foo!
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
",
)
Expand Down

0 comments on commit 731ae05

Please sign in to comment.