Skip to content
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

cargo add - fix for adding features from repository with multiple packages. #13213

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

stupendoussuperpowers
Copy link
Contributor

@stupendoussuperpowers stupendoussuperpowers commented Dec 28, 2023

Fixes #13121

As discussed in the issue, when using cargo add to add a package with features from a git repository from one of it's members, the command might fail due to improper target for querying for said features.

This PR adds a test for this edge-case where we expect it to fail with current code. It also adds a fix for this, and updates the test to expect success.

While populating available features, the current code does a Fuzzy search which might lead to searching for features in a wrong member package. If we change it to an Exact query, we get back the proper member to search within.

@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added Command-add S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 28, 2023
@epage
Copy link
Contributor

epage commented Dec 28, 2023

Thanks for picking this up and moving it along!

@stupendoussuperpowers stupendoussuperpowers marked this pull request as draft December 28, 2023 22:45
@stupendoussuperpowers stupendoussuperpowers marked this pull request as ready for review December 28, 2023 23:40
@stupendoussuperpowers stupendoussuperpowers marked this pull request as draft December 29, 2023 04:32
@stupendoussuperpowers
Copy link
Contributor Author

have made the changes.

first commit - add a test that expects failure from said command (test passes)
second commit - fixes issue, updates test to expect success + appropriate output (test passes)

@epage
Copy link
Contributor

epage commented Dec 29, 2023

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Dec 29, 2023

📌 Commit e46d80e has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2023
@bors
Copy link
Contributor

bors commented Dec 29, 2023

⌛ Testing commit e46d80e with merge 4f70d17...

@bors
Copy link
Contributor

bors commented Dec 29, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 4f70d17 to master...

@bors bors merged commit 4f70d17 into rust-lang:master Dec 29, 2023
22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 1, 2024
Update cargo

7 commits in ac6bbb33293d8d424c17ecdb42af3aac25fb7295..ef94adb92704acf3967be8cf73ac0b01d818c47a
2023-12-26 23:22:08 +0000 to 2023-12-31 02:20:45 +0000
- cleanup: Remove error-format special-case in `cargo fix` (rust-lang/cargo#13224)
- `cargo fix`: always inherit the jobserver (rust-lang/cargo#13225)
- Bump cargo-credential to 0.4.3 (rust-lang/cargo#13221)
- `cargo add` - fix for adding features from repository with multiple packages. (rust-lang/cargo#13213)
- Remove repetitive words (rust-lang/cargo#13216)
- Add cargo:rustc-cdylib-link-arg into RESERVED_PREFIXES list (rust-lang/cargo#13212)
- chore(doc): doc for custom subcommands look up. (rust-lang/cargo#13203)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2024
Update cargo

11 commits in ac6bbb33293d8d424c17ecdb42af3aac25fb7295..add15366eaf3f3eb84717d3b8b71902ca36a7c84
2023-12-26 23:22:08 +0000 to 2024-01-02 03:24:42 +0000
- chore(deps): update gix (rust-lang/cargo#13230)
- chore(deps): update alpine docker tag to v3.19 (rust-lang/cargo#13228)
- rustfix: Support inserting new lines. (rust-lang/cargo#13226)
- Fix fix::fix_in_dependency to not rely on rustc (rust-lang/cargo#13220)
- cleanup: Remove error-format special-case in `cargo fix` (rust-lang/cargo#13224)
- `cargo fix`: always inherit the jobserver (rust-lang/cargo#13225)
- Bump cargo-credential to 0.4.3 (rust-lang/cargo#13221)
- `cargo add` - fix for adding features from repository with multiple packages. (rust-lang/cargo#13213)
- Remove repetitive words (rust-lang/cargo#13216)
- Add cargo:rustc-cdylib-link-arg into RESERVED_PREFIXES list (rust-lang/cargo#13212)
- chore(doc): doc for custom subcommands look up. (rust-lang/cargo#13203)
@ehuss ehuss added this to the 1.77.0 milestone Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-add S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
5 participants