mirror of
https://github.com/rust-lang/cargo
synced 2024-08-25 02:25:46 +00:00
Fix publishing to crates.io with -Z sparse-registry
This commit is contained in:
parent
c0bbd42ce5
commit
132afd3f1b
|
@ -196,10 +196,6 @@ fn verify_dependencies(
|
|||
if super::check_dep_has_version(dep, true)? {
|
||||
continue;
|
||||
}
|
||||
// Allow publishing to crates.io with index.crates.io as a source replacement.
|
||||
if registry_src.is_default_registry() && dep.source_id().is_default_registry() {
|
||||
continue;
|
||||
}
|
||||
// TomlManifest::prepare_for_publish will rewrite the dependency
|
||||
// to be just the `version` field.
|
||||
if dep.source_id() != registry_src {
|
||||
|
@ -535,6 +531,13 @@ fn registry(
|
|||
None
|
||||
};
|
||||
let handle = http_handle(config)?;
|
||||
// Workaround for the sparse+https://index.crates.io replacement index. Use the non-replaced
|
||||
// source_id so that the original (github) url is used when publishing a crate.
|
||||
let sid = if sid.is_default_registry() {
|
||||
SourceId::crates_io(config)?
|
||||
} else {
|
||||
sid
|
||||
};
|
||||
Ok((Registry::new_handle(api_host, token, handle), reg_cfg, sid))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue