You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the package vendor dir has a version number (eg because it's not the most recent, or --versioned-dirs is in use)
the code has changed
This can happen if the code is coming from a git repo and the rev has been updated, if a patch has been added in the [patch] section of the Cargo.toml, or when switching between crates.io and git as a source.
This doesn't happen for non-versioned directories because cargo vendor unconditionally re-vendors their contents.
Possible Solution(s)
Rather than just comparing the version, it should also check for changes to the patch and/or origin specification.
Notes
Output of cargo version: 1.42, but this hasn't changed in recent versions
The text was updated successfully, but these errors were encountered:
fix(vendor): trust crate version only when coming from registries
### What does this PR try to resolve?
Fixes#8181
Relates to #11897 and #14525
### How should we test and review this PR?
As mentioned in the contribution guide, I made a first commit adding a test that passes with the actual behaviour. Then, I made a second commit with a fix and modified the test with the new expected behaviour.
### Additional information
The fix doesn't take into account switching from a git dependency to crates.io, which is not handled correctly on master either, and would probably require the vendoring to serialize the source ID to detect source changes.
I specifically limited the trust of immutable version to crates.io, but it could be extended to other registries.
Problem
cargo vendor
fails to re-vendor a package if:--versioned-dirs
is in use)This can happen if the code is coming from a git repo and the
rev
has been updated, if a patch has been added in the[patch]
section of the Cargo.toml, or when switching between crates.io and git as a source.This doesn't happen for non-versioned directories because
cargo vendor
unconditionally re-vendors their contents.Possible Solution(s)
Rather than just comparing the version, it should also check for changes to the patch and/or origin specification.
Notes
Output of
cargo version
: 1.42, but this hasn't changed in recent versionsThe text was updated successfully, but these errors were encountered: