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 fetching git repos after a force push. #9979

Merged
merged 1 commit into from
Oct 18, 2021

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Oct 18, 2021

Users have been reporting that the index has not been updating for them. This was caused by the update to libgit2 1.3 (from 1.1) which has changed some behavior around force pushes. The index was squashed on 2021-09-24, and if a user had the index fetched from before that point, and they used nightly-2021-10-14 or newer, then the fetch would succeed, but the refs/remotes/origin/HEAD would not get updated. Cargo uses the origin/HEAD ref to know what to look at, and thus was looking at old data.

The solution here is to use + on the refspec to force libgit2 to do a forced update (a fast-forward). I think this may have been introduced in libgit2 1.2 via libgit2/libgit2#5854, though that is just a guess.

Fixes #9976

@rust-highfive
Copy link

r? @Eh2406

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2021
@alexcrichton
Copy link
Member

Nice find on this!

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 18, 2021

📌 Commit 8d5576b has been approved by alexcrichton

@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 Oct 18, 2021
@bors
Copy link
Contributor

bors commented Oct 18, 2021

⌛ Testing commit 8d5576b with merge 1e5be5f...

@ehuss ehuss added the beta-nominated Nominated to backport to the beta branch. label Oct 18, 2021
@bors
Copy link
Contributor

bors commented Oct 18, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing 1e5be5f to master...

@bors bors merged commit 1e5be5f into rust-lang:master Oct 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 19, 2021
Update cargo

6 commits in c7957a74bdcf3b11e7154c1a9401735f23ebd484..7fbbf4e8f23e3c24b8afff541dcb17e53eb5ff88
2021-10-11 20:17:07 +0000 to 2021-10-19 02:16:48 +0000
- Make future-incompat-report output more user-friendly (rust-lang/cargo#9953)
- Fix fetching git repos after a force push. (rust-lang/cargo#9979)
- Add rustc-link-args to doctest build (rust-lang/cargo#9916)
- Add the start of a basic benchmarking suite. (rust-lang/cargo#9955)
- Use forms for issue templates. (rust-lang/cargo#9970)
- Add rust_metadata to SerializedPackage (rust-lang/cargo#9967)
ehuss pushed a commit to ehuss/cargo that referenced this pull request Oct 20, 2021
Fix fetching git repos after a force push.

Users have been reporting that the index has not been updating for them.  This was caused by the update to libgit2 1.3 (from 1.1) which has changed some behavior around force pushes.  The index was squashed on 2021-09-24, and if a user had the index fetched from before that point, and they used nightly-2021-10-14 or newer, then the fetch would succeed, but the `refs/remotes/origin/HEAD` would not get updated.  Cargo uses the `origin/HEAD` ref to know what to look at, and thus was looking at old data.

The solution here is to use `+` on the refspec to force libgit2 to do a forced update (a fast-forward). I think this may have been introduced in libgit2 1.2 via libgit2/libgit2#5854, though that is just a guess.

Fixes rust-lang#9976
bors added a commit that referenced this pull request Oct 21, 2021
[beta] Fix fetching git repos after a force push.

Beta backport of #9979.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Oct 22, 2021
Includes rust-lang/cargo#9979: Fix fetching git repos after a force push.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 22, 2021
…ulacrum

[beta] backports

*  Don't emit a warning for empty rmeta files. rust-lang#90072
*  Erase late-bound regions before computing vtable debuginfo name. rust-lang#90050
*  Fix wrong niche calculation when 2+ niches are placed at the start rust-lang#90040
*  Revert rust-lang#86011 to fix an incorrect bound check rust-lang#90025
*  Fix macro_rules! duplication when reexported in the same module rust-lang#89867
* Bump cargo to include rust-lang/cargo#9979 - Fix fetching git repos after a force push.

r? `@Mark-Simulacrum`
@ehuss ehuss modified the milestones: 1.58.0, 1.57.0 Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-nominated Nominated to backport to the beta branch. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom targets with libc break cargo somehow.
5 participants