-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(add): Improve error when adding registry packages while vendored #13281
Conversation
r? @epage (rustbot has picked a reviewer for you, use r? to override) |
I recommend re-arranging the commits so the first commit shows the current behavior via a test and then the commit with the fix updates the test. This helps make clear to the reviewers what the behavior change was and ensures we "test the test" (assuming you ran the tests). I tried to do that with your branch and when i cherry-picked the test onto |
|
Its not just about the commit order but that every commit should pass |
cdb15d6
to
b049570
Compare
No problem, I've resubmitted the commits. |
The test is still the last commit. The test should be the first commit and it should pass as-is. The follow up changes should change the tests as the behavior changes which will show that the behavior did change in the intended way and that the test tests the right thing. Last I looked, it appeared that the current tests do not test the right thing. |
787a975
to
7b9d3f5
Compare
I reordered commits.
I've added two new tests, |
They were re-ordered but not updated so that every commit passes. I've pushed an update to your branch that does this. |
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/mod.rs
Outdated
Show resolved
Hide resolved
03705aa
to
e550de4
Compare
Thanks, it's been squashed |
I was asking for the last commit to be squashed, not all of them. |
6f5cbe2
to
4e22e35
Compare
my bad, I recreated the commit history with latest modifies |
As a reminder, each commit should pass tests. |
yes yes, recreated again |
Thanks for all of the work you put into this and patience through the back and forth! @bors r+ |
☀️ Test successful - checks-actions |
Update cargo 16 commits in 194a60b2952bd5d12ba15dd2577a97eed7d3c587..8964c8ccff6e420e2a38b8696d178d69fab84d9d 2024-02-21 01:53:45 +0000 to 2024-02-27 19:22:46 +0000 - feat: Add "-Zpublic-dependency" for public-dependency feature. (rust-lang/cargo#13340) - Stabilize global cache data tracking. (rust-lang/cargo#13492) - chore: bump baseline version requirement of sub crates (rust-lang/cargo#13494) - fix(doctest): search native libs in build script outputs (rust-lang/cargo#13490) - chore: fixed a typo(two->too) (rust-lang/cargo#13489) - test: relax help text assertion (rust-lang/cargo#13488) - refactor: clean up for `GlobalContext` rename (rust-lang/cargo#13486) - test(cli): Verify terminal styling (rust-lang/cargo#13461) - fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' (rust-lang/cargo#13479) - Error messages when collecting workspace members now mention the workspace root location (rust-lang/cargo#13480) - fix(add): Improve error when adding registry packages while vendored (rust-lang/cargo#13281) - [docs]:Add missing jump links (rust-lang/cargo#13478) - Add global_cache_tracker stability tests. (rust-lang/cargo#13467) - fix(cli): Control clap colors through config (rust-lang/cargo#13463) - chore: remove the unused function (rust-lang/cargo#13472) - Fix missing brackets (rust-lang/cargo#13470)
Update cargo 16 commits in 194a60b2952bd5d12ba15dd2577a97eed7d3c587..8964c8ccff6e420e2a38b8696d178d69fab84d9d 2024-02-21 01:53:45 +0000 to 2024-02-27 19:22:46 +0000 - feat: Add "-Zpublic-dependency" for public-dependency feature. (rust-lang/cargo#13340) - Stabilize global cache data tracking. (rust-lang/cargo#13492) - chore: bump baseline version requirement of sub crates (rust-lang/cargo#13494) - fix(doctest): search native libs in build script outputs (rust-lang/cargo#13490) - chore: fixed a typo(two->too) (rust-lang/cargo#13489) - test: relax help text assertion (rust-lang/cargo#13488) - refactor: clean up for `GlobalContext` rename (rust-lang/cargo#13486) - test(cli): Verify terminal styling (rust-lang/cargo#13461) - fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' (rust-lang/cargo#13479) - Error messages when collecting workspace members now mention the workspace root location (rust-lang/cargo#13480) - fix(add): Improve error when adding registry packages while vendored (rust-lang/cargo#13281) - [docs]:Add missing jump links (rust-lang/cargo#13478) - Add global_cache_tracker stability tests. (rust-lang/cargo#13467) - fix(cli): Control clap colors through config (rust-lang/cargo#13463) - chore: remove the unused function (rust-lang/cargo#13472) - Fix missing brackets (rust-lang/cargo#13470)
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
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:
#10729 (comment)
Test steps:
cargo vendor
command.alter-registry
to the config.toml file.cargo add
command.