From 2d59372e7a605360e084c40c5c14cdc52f7d570b Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sat, 23 Mar 2024 06:41:33 +1100 Subject: feat(publish): check for uncommitted files in `deno publish --dry-run` (#22981) Closes #22936 --- cli/tools/registry/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cli') diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index e323c6c79..b40aeaeb4 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -988,6 +988,15 @@ pub async fn publish( bail!("No packages to publish"); } + if std::env::var("DENO_TESTING_DISABLE_GIT_CHECK") + .ok() + .is_none() + && !publish_flags.allow_dirty + && check_if_git_repo_dirty(cli_options.initial_cwd()).await + { + bail!("Aborting due to uncommitted changes. Check in source code or run with --allow-dirty"); + } + if publish_flags.dry_run { for (_, package) in prepared_data.package_by_name { log::info!( @@ -1003,15 +1012,6 @@ pub async fn publish( return Ok(()); } - if std::env::var("DENO_TESTING_DISABLE_GIT_CHECK") - .ok() - .is_none() - && !publish_flags.allow_dirty - && check_if_git_repo_dirty(cli_options.initial_cwd()).await - { - bail!("Aborting due to uncommitted changes. Check in source code or run with --allow-dirty"); - } - perform_publish( cli_factory.http_client(), prepared_data.publish_order_graph, -- cgit v1.2.3