Skip to content

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

Open
enricobolzonello wants to merge 2 commits intorust-lang:masterfrom
enricobolzonello:git-and-alt
Open

feat(manifest): allow git dependency alongside alternate registry#16810
enricobolzonello wants to merge 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
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 proposed-final-comment-period An FCP proposal has started, but not yet signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cargo Team: Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

5 participants