Skip to content

fix: fetching non-standard git refspecs on non-github repos#16768

Merged
arlosi merged 2 commits intorust-lang:masterfrom
arlosi:fix-gitspec
Mar 20, 2026
Merged

fix: fetching non-standard git refspecs on non-github repos#16768
arlosi merged 2 commits intorust-lang:masterfrom
arlosi:fix-gitspec

Conversation

@arlosi
Copy link
Contributor

@arlosi arlosi commented Mar 19, 2026

What does this PR try to resolve?

Fixes #16767

After a lockfile is created, Cargo will attempt to fetch a git repo using the commit id. Since we only fetch the default refspecs in this case, the commit will be missing. This is not an issue for GitHub repos, since we have a GitHub fast path, and GitHub supports fetching by specific commit.

Fix by keeping track of the reference as written in the manifest, and pass it through to the portion that fetches.

How to test and review this PR?

First commit shows broken behavior, second commit shows fix.

r? @weihanglo

@rustbot rustbot added A-git Area: anything dealing with git A-registries Area: registries S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2026
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I hope one day we can stabilize shallow clones :)

View changes since this review

@arlosi arlosi added this pull request to the merge queue Mar 20, 2026
Merged via the queue into rust-lang:master with commit 6e62fbb Mar 20, 2026
29 checks passed
@arlosi arlosi deleted the fix-gitspec branch March 20, 2026 05:44
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2026
rust-bors bot pushed a commit to rust-lang/rust that referenced this pull request Mar 20, 2026
Update cargo submodule

13 commits in cbb9bb8bd0fb272b1be0d63a010701ecb3d1d6d3..d81735547e5f2844322f36380ab66f549cda11b9
2026-03-13 14:34:16 +0000 to 2026-03-20 13:20:51 +0000
- cargo clean: Validate that target_dir is not a file  (rust-lang/cargo#16765)
- fix: fetching non-standard git refspecs on non-github repos (rust-lang/cargo#16768)
- Update tar to 0.4.45 (rust-lang/cargo#16771)
- chore: Remove edition_lint_opts from Lint (rust-lang/cargo#16762)
- refactor: split out several smaller changes to prepare for async http (rust-lang/cargo#16763)
- fix(compile): Make build.warnings ignore non-local deps (rust-lang/cargo#16760)
- fix: detect circular publish dependency cycle in workspace publish (rust-lang/cargo#16722)
- refactor(shell): Pull out term integration into `anstyle-progress` (rust-lang/cargo#16757)
- test: reproduce rustfix panic on overlapping suggestions (rust-lang/cargo#16705)
- fix: Avoid panic for package specs with an empty fragment (rust-lang/cargo#16754)
- refactor(registry): avoid dynamic dispatch for Registry trait (rust-lang/cargo#16752)
- refactor(shell): Pull out hyperlink logic into anstyle-hyperlink (rust-lang/cargo#16749)
- refactor(install): Remove dead code (rust-lang/cargo#16718)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-git Area: anything dealing with git A-registries Area: registries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo cannot use gerrit for git dependencies

3 participants