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

fix(resolver): Don't do git fetches when updating workspace members #12975

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

epage
Copy link
Contributor

@epage epage commented Nov 14, 2023

What does this PR try to resolve?

Before, when running cargo update <member>, we'd not reuse the
previous resolve result and when the resolver started walking into the
dependencies, it would do a git fetch.

Now, we won't even try to resolve the workspace members and so we won't
look at those dependencies and do git fetch.

This will make cargo update <workspace-member>
match cargo update --workspace.

Fixes #12599
Fixes #8821

How should we test and review this PR?

I considered whether there were other ways of handling this but I
figured aiming for consistency in approaches was the best way.
We can investigate improving those approaches separately.

There are other discrepancies in the different code paths (handling of
patches, adding sources) but I'm deferring looking over those.

I added a test to demonstrate the --workspace behavior to use as a base line to compare with.

Additional information

Between this and #12602, this should finally resolve #12599.

Looks like `--workspace` and `-p <workspace-member>` behave differently.
Before, when running `cargo update <member>`, we'd not reuse the
previous resolve result and when the resolver started walking into the
dependencies, it would do a git fetch.

Now, we won't even try to resolve the workspace members and so we won't
look at those dependencies and do git fetch.

This will make `cargo update <workspace-member>`
match `cargo update --workspace`.
I considered whether there were other ways of handling this but I
figured aiming for consistency in approaches was the best way.
We can investigate improving those approaches separately.

There are other discrepancies in the different code paths (handling of
patches, adding sources) but I'm deferring looking over those.

Between this and rust-lang#12602, this should finnally resolve rust-lang#12599.

Fixes rust-lang#12599
@rustbot
Copy link
Collaborator

rustbot commented Nov 14, 2023

r? @weihanglo

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

@rustbot rustbot added Command-generate-lockfile S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 14, 2023
@weihanglo
Copy link
Member

Thanks for the fix!

@bors r+

@bors
Copy link
Contributor

bors commented Nov 18, 2023

📌 Commit 9ca6376 has been approved by weihanglo

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 Nov 18, 2023
@bors
Copy link
Contributor

bors commented Nov 18, 2023

⌛ Testing commit 9ca6376 with merge 4ac051e...

@bors
Copy link
Contributor

bors commented Nov 18, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 4ac051e to master...

@bors bors merged commit 4ac051e into rust-lang:master Nov 18, 2023
20 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
Update cargo

9 commits in 9765a449d9b7341c2b49b88da41c2268ea599720..71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6
2023-11-17 20:58:23 +0000 to 2023-11-20 15:30:57 +0000
- Handle $message_type in JSON diagnostics (rust-lang/cargo#13016)
- refactor(toml): Further clean up inheritance (rust-lang/cargo#13000)
- Fix `--check-cfg` invocations with zero features (rust-lang/cargo#13011)
- chore: bump `cargo-credential-*` crates as e58b84d broke stuff (rust-lang/cargo#13010)
- contrib docs: Update now that credential crates are published. (rust-lang/cargo#13006)
- Add more resources to the contrib docs. (rust-lang/cargo#13008)
- Respect `rust-lang/rust`'s `omit-git-hash` (rust-lang/cargo#12968)
- Fix clippy-wrapper test race condition. (rust-lang/cargo#12999)
- fix(resolver): Don't do git fetches when updating workspace members (rust-lang/cargo#12975)
@epage epage deleted the git branch November 28, 2023 21:53
@ehuss ehuss added this to the 1.76.0 milestone Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-generate-lockfile 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