Skip to content

Commit

Permalink
refactor(publish): Clarify we prepare_transmit using the local package
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 30, 2024
1 parent 53fe2b6 commit dc9014d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/cargo/ops/registry/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ fn verify_dependencies(

pub(crate) fn prepare_transmit(
gctx: &GlobalContext,
pkg: &Package,
local_pkg: &Package,
registry_id: SourceId,
) -> CargoResult<NewCrate> {
let deps = pkg
let deps = local_pkg
.dependencies()
.iter()
.filter(|dep| {
Expand Down Expand Up @@ -378,7 +378,7 @@ pub(crate) fn prepare_transmit(
})
})
.collect::<CargoResult<Vec<NewCrateDependency>>>()?;
let manifest = pkg.manifest();
let manifest = local_pkg.manifest();
let ManifestMetadata {
ref authors,
ref description,
Expand All @@ -398,12 +398,13 @@ pub(crate) fn prepare_transmit(
let readme_content = readme
.as_ref()
.map(|readme| {
paths::read(&pkg.root().join(readme))
.with_context(|| format!("failed to read `readme` file for package `{}`", pkg))
paths::read(&local_pkg.root().join(readme)).with_context(|| {
format!("failed to read `readme` file for package `{}`", local_pkg)
})
})
.transpose()?;
if let Some(ref file) = *license_file {
if !pkg.root().join(file).exists() {
if !local_pkg.root().join(file).exists() {
bail!("the license file `{}` does not exist", file)
}
}
Expand Down Expand Up @@ -440,8 +441,8 @@ pub(crate) fn prepare_transmit(
};

Ok(NewCrate {
name: pkg.name().to_string(),
vers: pkg.version().to_string(),
name: local_pkg.name().to_string(),
vers: local_pkg.version().to_string(),
deps,
features: string_features,
authors: authors.clone(),
Expand Down

0 comments on commit dc9014d

Please sign in to comment.