mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
fix(vendor): trust crate version only when coming from registries
This commit is contained in:
parent
5fa43ee1c5
commit
a53b81a49d
@ -207,8 +207,10 @@ fn sync(
|
||||
let dst = canonical_destination.join(&dst_name);
|
||||
to_remove.remove(&dst);
|
||||
let cksum = dst.join(".cargo-checksum.json");
|
||||
if dir_has_version_suffix && cksum.exists() {
|
||||
// Always re-copy directory without version suffix in case the version changed
|
||||
// Registries are the only immutable sources,
|
||||
// path and git dependencies' versions cannot be trusted to mean "no change"
|
||||
if dir_has_version_suffix && id.source_id().is_registry() && cksum.exists() {
|
||||
// Don't re-copy directory with version suffix in case it comes from a registry
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1626,7 +1626,7 @@ fn git_update_rev() {
|
||||
.run();
|
||||
|
||||
let lib = p.read_file("vendor/a-0.1.0/src/lib.rs");
|
||||
assert_e2e().eq(lib, "");
|
||||
assert_e2e().eq(lib, "pub fn f() {}");
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user