-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 corrupted git checkout recovery. #10829
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ehuss: no appropriate reviewer found, use r? to override |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jul 6, 2022
Looks good to me. |
weihanglo
approved these changes
Jul 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense!
@bors r+ |
📌 Commit c46e57b has been approved by |
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
Jul 6, 2022
☀️ Test successful - checks-actions |
weihanglo
added a commit
to weihanglo/rust
that referenced
this pull request
Jul 10, 2022
…79e13a071ad4b17435bd6bfa4c 2022-07-03 13:41:11 +0000 to 2022-07-09 14:48:50 +0000 - Mention `[patch]` config in "Overriding Dependencies" (rust-lang/cargo#10836) - Update terminal-width flag. (rust-lang/cargo#10833) - Refactor check_yanked to avoid some duplication (rust-lang/cargo#10835) - Fix publishing to crates.io with -Z sparse-registry (rust-lang/cargo#10831) - Make `is_yanked` return `Poll<>` (rust-lang/cargo#10830) - Fix corrupted git checkout recovery. (rust-lang/cargo#10829) - add a cache for discovered workspace roots (rust-lang/cargo#10776)
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 10, 2022
Update cargo 7 commits in c0bbd42ce5e83fe2a93e817c3f9b955492d3130a..b1dd22e668af5279e13a071ad4b17435bd6bfa4c 2022-07-03 13:41:11 +0000 to 2022-07-09 14:48:50 +0000 - Mention `[patch]` config in "Overriding Dependencies" (rust-lang/cargo#10836) - Update terminal-width flag. (rust-lang/cargo#10833) - Refactor check_yanked to avoid some duplication (rust-lang/cargo#10835) - Fix publishing to crates.io with -Z sparse-registry (rust-lang/cargo#10831) - Make `is_yanked` return `Poll<>` (rust-lang/cargo#10830) - Fix corrupted git checkout recovery. (rust-lang/cargo#10829) - add a cache for discovered workspace roots (rust-lang/cargo#10776)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where cargo would not recover from a corrupted git checkout correctly when using
net.git-fetch-with-cli
.Git dependencies have two clones, the "db" and the "checkout". The "db" is shared amongst multiple checkout revisions from the same repository. The "checkout" is each individual revision. There was some code in
copy_to
which creates the "checkout" that tries to recover from an error. The "checkout" can be invalid if cargo was interrupted while cloning it, or if there is fs corruption. However, that code was failing when using the git CLI. For reasons I did not dig into, the "db" does not have a HEAD ref, so that special-case fetch was failing with acouldn't find remote ref HEAD
error fromgit
.This changes it so that if the "checkout" is invalid, it just gets blown away and a new clone is created (instead of calling
git fetch
from the "db").I believe there is some long history for this
copy_to
code where it made more sense in the past. Previously, the "checkout" directories used theGitReference
string as-is. So, for example, a branch would checkout into a directory with that branch name. At some point, it was changed so that each checkout uses a short hash of the actual revision. Rebuilding the checkout made sense when it was possible for that checkout revision to change (like if new commits were pushed to a branch). That recovery is no longer necessary since a checkout is only ever one revision.Fixes #10826