Skip to content

Commit 2e22f3f

Browse files
committed
make inline checksums optional but default
1 parent 5a180c8 commit 2e22f3f

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/main.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ use anyhow::{anyhow, Context as _};
2121
use cargo::core::registry::PackageRegistry;
2222
use cargo::core::resolver::features::HasDevUnits;
2323
use cargo::core::resolver::CliFeatures;
24-
use cargo::core::GitReference;
25-
use cargo::core::{Package, PackageId, PackageSet, Resolve, Workspace};
24+
use cargo::core::{GitReference, Package, PackageId, PackageSet, Resolve, Workspace};
2625
use cargo::ops;
2726
use cargo::util::{important_paths, CargoResult};
2827
use cargo::{CliResult, Config};
@@ -152,8 +151,12 @@ struct Args {
152151
#[structopt(short = "R")]
153152
reproducible: bool,
154153

154+
/// Don't emit inline checksums
155+
#[structopt(short = "c", long)]
156+
no_checksums: bool,
157+
155158
/// Legacy Overrides: Use legacy override syntax
156-
#[structopt(short = "l", long = "--legacy-overrides")]
159+
#[structopt(short, long)]
157160
legacy_overrides: bool,
158161
}
159162

@@ -230,13 +233,23 @@ fn real_main(options: Args, config: &mut Config) -> CliResult {
230233
None
231234
} else if src_id.is_registry() {
232235
// this package appears in a crate registry
233-
Some(format!(
234-
" crate://{}/{}/{}{} \\\n",
235-
CRATES_IO_URL,
236-
pkg.name(),
237-
pkg.version(),
238-
get_checksum(&package_set, pkg)
239-
))
236+
if options.no_checksums {
237+
Some(format!(
238+
" crate://{}/{}/{} \\\n",
239+
CRATES_IO_URL,
240+
pkg.name(),
241+
pkg.version()
242+
))
243+
}
244+
else {
245+
Some(format!(
246+
" crate://{}/{}/{}{} \\\n",
247+
CRATES_IO_URL,
248+
pkg.name(),
249+
pkg.version(),
250+
get_checksum(&package_set, pkg)
251+
))
252+
}
240253
} else if src_id.is_path() {
241254
// we don't want to spit out path based
242255
// entries since they're within the crate

0 commit comments

Comments
 (0)