Skip to content

Commit 24f957d

Browse files
committed
fix(package): Don't verify registry for --list
Since `--list` is doing nothing with registries, imo, it shouldn't error if `CARGO_REGISTRY_DEFAULT` is not in `package.publish`. This also affects `--registry` and `--index` but that should be fine. Fixes crate-ci/cargo-release#921
1 parent 2531160 commit 24f957d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/cargo/ops/cargo_package/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fn do_package<'a>(
276276
// `package.publish`.
277277
let needs_local_reg = deps.has_dependencies() && (opts.include_lockfile || opts.verify);
278278
let verify_registry_allow_list = opts.reg_or_index.is_some();
279-
let mut local_reg = if needs_local_reg || verify_registry_allow_list {
279+
let mut local_reg = if !opts.list && (needs_local_reg || verify_registry_allow_list) {
280280
let sid = get_registry(ws.gctx(), &just_pkgs, opts.reg_or_index.clone())?;
281281
debug!("packaging for registry {}", sid);
282282
let reg_dir = ws.build_dir().join("package").join("tmp-registry");

tests/testsuite/package.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6795,10 +6795,11 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
67956795
.run();
67966796

67976797
p.cargo("package --registry alternative --list")
6798-
.with_status(101)
6799-
.with_stderr_data(str![[r#"
6800-
[ERROR] `foo` cannot be packaged.
6801-
The registry `alternative` is not listed in the `package.publish` value in Cargo.toml.
6798+
.with_stdout_data(str![[r#"
6799+
Cargo.lock
6800+
Cargo.toml
6801+
Cargo.toml.orig
6802+
src/main.rs
68026803
68036804
"#]])
68046805
.run();

0 commit comments

Comments
 (0)