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

Store the sparse+ prefix in the SourceId for sparse registries #11387

Merged
merged 2 commits into from
Nov 27, 2022

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Nov 17, 2022

#11209 added a new SourceKind::SparseRegistry and removed the sparse+ prefix from the URLs stored in the SourceId.

The removal of the sparse+ prefix from the URLs in the SourceId has led to several bugs, since registry URLs no longer round-trip through a SourceId. The most recent one I found was that the example configuration generated by cargo vendor did not include the sparse+ prefix. Any place that calls the .url() method on a SourceId potentially has this bug.

This change puts the sparse+ prefix back in the URL stored in the SourceId, but keeps the new SourceKind::SparseRegistry.

A test is added for doing cargo vendor on an alternative registry using the sparse protocol.

@arlosi
Copy link
Contributor Author

arlosi commented Nov 17, 2022

An alternative fix would be to emit all URLs with the protocol specifier (git registry URLs as registry+ and sparse registry URLs as sparse+).

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 2022

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 17, 2022
@arlosi arlosi changed the title Store the sparse+ prefix in the URL for sparse registries Store the sparse+ prefix in the SourceId for sparse registries Nov 17, 2022
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.

The reset looks good to me. Thank you!

src/cargo/sources/registry/http_remote.rs Outdated Show resolved Hide resolved
@weihanglo
Copy link
Member

Pardon my commit on this PR. Going to merge this.

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

📌 Commit 37d9b5c has been approved by weihanglo

It is now in the queue for this repository.

@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 Nov 27, 2022
@bors
Copy link
Collaborator

bors commented Nov 27, 2022

⌛ Testing commit 37d9b5c with merge a004f94...

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing a004f94 to master...

@bors bors merged commit a004f94 into rust-lang:master Nov 27, 2022
weihanglo added a commit to weihanglo/rust that referenced this pull request Dec 3, 2022
9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306
2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000
- Refactor generate_targets into separate module (rust-lang/cargo#11445)
- Improve file found in multiple build targets warning (rust-lang/cargo#11299)
- Error when precise without -p flag (rust-lang/cargo#11349)
- Improve strategy for selecting targets to be scraped for examples (rust-lang/cargo#11430)
- Aware of compression ratio for unpack size limit (rust-lang/cargo#11337)
- Add test for rustdoc-map generation when using sparse registries (rust-lang/cargo#11403)
- Add error message when `cargo fix` on an empty repo (rust-lang/cargo#11400)
- Store the sparse+ prefix in the SourceId for sparse registries (rust-lang/cargo#11387)
- Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (rust-lang/cargo#11425)
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2022
Update cargo

9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306
2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000
- Refactor generate_targets into separate module (rust-lang/cargo#11445)
- Improve file found in multiple build targets warning (rust-lang/cargo#11299)
- Error when precise without -p flag (rust-lang/cargo#11349)
- Improve strategy for selecting targets to be scraped for examples (rust-lang/cargo#11430)
- Aware of compression ratio for unpack size limit (rust-lang/cargo#11337)
- Add test for rustdoc-map generation when using sparse registries (rust-lang/cargo#11403)
- Add error message when `cargo fix` on an empty repo (rust-lang/cargo#11400)
- Store the sparse+ prefix in the SourceId for sparse registries (rust-lang/cargo#11387)
- Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (rust-lang/cargo#11425)
@ehuss ehuss added this to the 1.67.0 milestone Dec 14, 2022
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants