Skip to content

Commit 8d42b0e

Browse files
committed
Auto merge of #10764 - kornelski:clarify-http, r=Eh2406
Use specific terminology for sparse HTTP-based registry Before the options is popularized, I'd like to take opportunity to give it a unique name used consistently. It's been called "http" registry, but that's a rather generic term, especially that existing git-based registry also uses HTTP as its transport. New registry URLs use `sparse+https://` prefix, so calling it "sparse" registry seems more appropriate. #9069
2 parents 17f8088 + 288856b commit 8d42b0e

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
- Start work on inheriting manifest values in a workspace.
158158
[#10497](https://github.com/rust-lang/cargo/pull/10497)
159159
[#10517](https://github.com/rust-lang/cargo/pull/10517)
160-
- Added support for HTTP registries.
160+
- Added support for sparse HTTP registries.
161161
[#10470](https://github.com/rust-lang/cargo/pull/10470)
162162
[#10064](https://github.com/rust-lang/cargo/pull/10064)
163163
- Fixed panic when artifact target is used for `[target.'cfg(<target>)'.dependencies]`

src/cargo/core/features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ unstable_cli_options!(
653653
no_index_update: bool = ("Do not update the registry index even if the cache is outdated"),
654654
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
655655
host_config: bool = ("Enable the [host] section in the .cargo/config.toml file"),
656-
http_registry: bool = ("Support HTTP-based crate registries"),
656+
sparse_registry: bool = ("Support plain-HTTP-based crate registries"),
657657
target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"),
658658
rustdoc_map: bool = ("Allow passing external documentation mappings to rustdoc"),
659659
separate_nightlies: bool = (HIDDEN),
@@ -907,7 +907,7 @@ impl CliUnstable {
907907
"multitarget" => self.multitarget = parse_empty(k, v)?,
908908
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
909909
"terminal-width" => self.terminal_width = Some(parse_usize_opt(v)?),
910-
"http-registry" => self.http_registry = parse_empty(k, v)?,
910+
"sparse-registry" => self.sparse_registry = parse_empty(k, v)?,
911911
"namespaced-features" => stabilized_warn(k, "1.60", STABILISED_NAMESPACED_FEATURES),
912912
"weak-dep-features" => stabilized_warn(k, "1.60", STABILIZED_WEAK_DEP_FEATURES),
913913
"credential-process" => self.credential_process = parse_empty(k, v)?,

src/cargo/core/source/source_id.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ impl SourceId {
208208
}
209209

210210
/// Returns the `SourceId` corresponding to the main repository, using the
211-
/// http index if allowed.
212-
pub fn crates_io_maybe_http(config: &Config) -> CargoResult<SourceId> {
213-
if config.cli_unstable().http_registry {
211+
/// sparse HTTP index if allowed.
212+
pub fn crates_io_maybe_sparse_http(config: &Config) -> CargoResult<SourceId> {
213+
if config.cli_unstable().sparse_registry {
214214
config.check_registry_index_not_set()?;
215215
let url = CRATES_IO_HTTP_INDEX.into_url().unwrap();
216216
SourceId::new(SourceKind::Registry, url, Some(CRATES_IO_REGISTRY))

src/cargo/sources/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ impl<'cfg> SourceConfigMap<'cfg> {
9191
replace_with: None,
9292
},
9393
)?;
94-
if config.cli_unstable().http_registry {
94+
if config.cli_unstable().sparse_registry {
9595
base.add(
9696
CRATES_IO_REGISTRY,
9797
SourceConfig {
98-
id: SourceId::crates_io_maybe_http(config)?,
98+
id: SourceId::crates_io_maybe_sparse_http(config)?,
9999
replace_with: None,
100100
},
101101
)?;
@@ -257,7 +257,7 @@ restore the source replacement configuration to continue the build
257257
check_not_set("rev", def.rev)?;
258258
}
259259
if name == CRATES_IO_REGISTRY && srcs.is_empty() {
260-
srcs.push(SourceId::crates_io_maybe_http(self.config)?);
260+
srcs.push(SourceId::crates_io_maybe_sparse_http(self.config)?);
261261
}
262262

263263
match srcs.len() {

src/cargo/sources/registry/http_remote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ impl<'cfg> HttpRegistry<'cfg> {
131131
config: &'cfg Config,
132132
name: &str,
133133
) -> CargoResult<HttpRegistry<'cfg>> {
134-
if !config.cli_unstable().http_registry {
135-
anyhow::bail!("usage of HTTP-based registries requires `-Z http-registry`");
134+
if !config.cli_unstable().sparse_registry {
135+
anyhow::bail!("usage of sparse registries requires `-Z sparse-registry`");
136136
}
137137
let url = source_id.url().as_str();
138138
// Ensure the url ends with a slash so we can concatenate paths.

src/doc/src/reference/unstable.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Each new feature described below should explain how to use it.
102102
* Registries
103103
* [credential-process](#credential-process) — Adds support for fetching registry tokens from an external authentication program.
104104
* [`cargo logout`](#cargo-logout) — Adds the `logout` command to remove the currently saved registry token.
105-
* [http-registry](#http-registry) — Adds support for fetching from http registries (`sparse+`)
105+
* [sparse-registry](#sparse-registry) — Adds support for fetching from static-file HTTP registries (`sparse+`)
106106

107107
### allow-features
108108

@@ -909,18 +909,18 @@ fn main() {
909909
}
910910
```
911911

912-
### http-registry
912+
### sparse-registry
913913
* Tracking Issue: [9069](https://github.com/rust-lang/cargo/issues/9069)
914914
* RFC: [#2789](https://github.com/rust-lang/rfcs/pull/2789)
915915

916-
The `http-registry` feature allows cargo to interact with remote registries served
917-
over http rather than git. These registries can be identified by urls starting with
916+
The `sparse-registry` feature allows cargo to interact with remote registries served
917+
over plain HTTP rather than git. These registries can be identified by urls starting with
918918
`sparse+http://` or `sparse+https://`.
919919

920-
When fetching index metadata over http, cargo only downloads the metadata for relevant
920+
When fetching index metadata over HTTP, cargo only downloads the metadata for relevant
921921
crates, which can save significant time and bandwidth.
922922

923-
The format of the http index is identical to a checkout of a git-based index.
923+
The format of the sparse index is identical to a checkout of a git-based index.
924924

925925
### credential-process
926926
* Tracking Issue: [#8933](https://github.com/rust-lang/cargo/issues/8933)
@@ -1597,4 +1597,4 @@ See the [Features chapter](features.md#dependency-features) for more information
15971597

15981598
The `-Ztimings` option has been stabilized as `--timings` in the 1.60 release.
15991599
(`--timings=html` and the machine-readable `--timings=json` output remain
1600-
unstable and require `-Zunstable-options`.)
1600+
unstable and require `-Zunstable-options`.)

tests/testsuite/registry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::path::Path;
1414

1515
fn cargo_http(p: &Project, s: &str) -> Execs {
1616
let mut e = p.cargo(s);
17-
e.arg("-Zhttp-registry").masquerade_as_nightly_cargo();
17+
e.arg("-Zsparse-registry").masquerade_as_nightly_cargo();
1818
e
1919
}
2020

@@ -2643,13 +2643,13 @@ fn http_requires_z_flag() {
26432643

26442644
p.cargo("build")
26452645
.with_status(101)
2646-
.with_stderr_contains(" usage of HTTP-based registries requires `-Z http-registry`")
2646+
.with_stderr_contains(" usage of sparse registries requires `-Z sparse-registry`")
26472647
.run();
26482648
}
26492649

26502650
#[cargo_test]
26512651
fn http_requires_trailing_slash() {
2652-
cargo_process("-Z http-registry install bar --index sparse+https://index.crates.io")
2652+
cargo_process("-Z sparse-registry install bar --index sparse+https://index.crates.io")
26532653
.masquerade_as_nightly_cargo()
26542654
.with_status(101)
26552655
.with_stderr("[ERROR] registry url must end in a slash `/`: sparse+https://index.crates.io")

0 commit comments

Comments
 (0)