mirror of
https://github.com/rust-lang/cargo
synced 2024-10-30 03:28:38 +00:00
e08a81333c
fix(add): Improve error when adding registry packages while vendored ### **What does this PR try to resolve?** When a vendored directory is established, cargo add no longer adds new packages. Instead, it tries to translate a package name into a package that already exists in the vendored directory. [More details](https://github.com/rust-lang/cargo/issues/10729#issue-1260548746) Since `@epage` has done most of the work, here I do the rest of the finishing work. Improves the error from #10729 ### **How should we test and review this PR?** The implementation procedure is as follows: https://github.com/rust-lang/cargo/issues/10729#issuecomment-1191633351 Test steps: 1. Try to get an arbitrary crate and execute `cargo vendor` command. 2. Configure the vendor directory in .cargo/config.toml. 3. Add `alter-registry` to the config.toml file. ``` [registries] alter-registry= { index = "XXX" } ``` 4. run the same `cargo add` command. ``` cargo add another-crate --registry alter-registry ``` |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |