Skip to content

feat(manifest): allow git dependency alongside alternate registry#16810

Merged
arlosi merged 2 commits intorust-lang:masterfrom
enricobolzonello:git-and-alt
Apr 7, 2026
Merged

feat(manifest): allow git dependency alongside alternate registry#16810
arlosi merged 2 commits intorust-lang:masterfrom
enricobolzonello:git-and-alt

Conversation

@enricobolzonello
Copy link
Copy Markdown
Contributor

@enricobolzonello enricobolzonello commented Mar 31, 2026

What does this PR try to resolve?

Removes the restriction that prevented combining git with registry (or registry-index), bringing alternate registries to parity with crates.io for the multiple locations feature.

Previously, any combination of git + registry was rejected. Now:

  • git + path is still always rejected
  • registry + registry_index together is still rejected
  • git + registry is allowed: the git arm (Some(git), None, _, _) handles it

At publishing time, it already stripped all git fields, leaving only registry, so it required no changes.

Fixes #10875

How to test and review this PR?

Run tests:

  • registry_and_git_dep_works
  • publish_with_git_and_registry_dep

in alt_registry test suite, and:

  • git_registry

in cargo_add test suite.

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 31, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@epage
Copy link
Copy Markdown
Contributor

epage commented Apr 1, 2026

Please update your commits for how they should be revewered and merged, rather than reflecting your development process. Within a PR, there isn't much reason to have a revert commit.

@enricobolzonello
Copy link
Copy Markdown
Contributor Author

Please update your commits for how they should be revewered and merged, rather than reflecting your development process. Within a PR, there isn't much reason to have a revert commit.

ok, I squashed the revert commit into the original commit.

@epage epage added the T-cargo Team: Cargo label Apr 1, 2026
@epage
Copy link
Copy Markdown
Contributor

epage commented Apr 1, 2026

@rfcbot fcp merge cargo

Currently, you can have

dep = { version = "1", git = "..." }

which gets stripped on publish to

dep = { version = "1" }

but you can't have

dep = { version = "1", registry = "foo", git = "..." }

This PR fixes so registry can be used with git as discussed in a Cargo team meeting around Oct 28, 2025

@rust-rfcbot
Copy link
Copy Markdown
Collaborator

rust-rfcbot commented Apr 1, 2026

Team member @epage has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Apr 1, 2026
@ehuss ehuss moved this to FCP merge in Cargo status tracker Apr 7, 2026
@rust-rfcbot rust-rfcbot added final-comment-period FCP — a period for last comments before action is taken and removed proposed-final-comment-period An FCP proposal has started, but not yet signed off. labels Apr 7, 2026
@rust-rfcbot
Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@arlosi arlosi added this pull request to the merge queue Apr 7, 2026
@arlosi
Copy link
Copy Markdown
Contributor

arlosi commented Apr 7, 2026

This seems un-contentious enough to avoid waiting the 10 day FCP period.

Merged via the queue into rust-lang:master with commit 45c2341 Apr 7, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 7, 2026
rust-bors bot pushed a commit to rust-lang/rust that referenced this pull request Apr 8, 2026
Cargo submodule update

11 commits in a357df4c26fc14514e66aae2a269456b5545c7db..101549dddbd2b08e806f50154e3aa4cb3374cc21
2026-04-03 16:47:15 +0000 to 2026-04-08 12:51:20 +0000
- Never include use extra-filename in build scripts (rust-lang/cargo#16855)
- fix(toml): Force script edition warnings on quiet  (rust-lang/cargo#16848)
- GitHub fast path uses `http_async` (rust-lang/cargo#16847)
- feat(manifest): allow git dependency alongside alternate registry (rust-lang/cargo#16810)
- fix(auth): add auth scheme hint to token rejected error for alt registries (rust-lang/cargo#16794)
- Warn on invalid jobserver file descriptors (rust-lang/cargo#16843)
- docs(unstable): List the minimum required MSRV for 'public' field (rust-lang/cargo#16841)
- feat(lints): Emit unused_dependencies lint (rust-lang/cargo#16600)
- fix(tree): clarify error message when `-i` is used without a package name (rust-lang/cargo#16818)
- fix: Typo in target.<cfg>.linker (rust-lang/cargo#16839)
- Send Content-Type header with cargo publish requests (rust-lang/cargo#16832)

r? ghost
@rustbot rustbot added this to the 1.96.0 milestone Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues disposition-merge FCP with intent to merge final-comment-period FCP — a period for last comments before action is taken T-cargo Team: Cargo

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Can't publish to our crates registry if git is also specified

6 participants