From 7e48c5dedcfd5d0124bb9f39079a03e27ed23886 Mon Sep 17 00:00:00 2001 From: SteveLauC Date: Thu, 1 Jun 2023 15:16:01 +0800 Subject: [PATCH] fix: warn user about bad pattern paths before skipping step git (#456) --- src/steps/git.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/steps/git.rs b/src/steps/git.rs index d57f5f4b..4385e642 100644 --- a/src/steps/git.rs +++ b/src/steps/git.rs @@ -178,15 +178,21 @@ impl Git { None } pub fn multi_pull_step(&self, repositories: &Repositories, ctx: &ExecutionContext) -> Result<()> { + // Warn the user about the bad patterns. + // + // NOTE: this should be executed **before** skipping the Git step or the + // user won't receive this warning in the cases where all the paths configured + // are bad patterns. + repositories + .bad_patterns + .iter() + .for_each(|pattern| print_warning(format!("Path {pattern} did not contain any git repositories"))); + if repositories.repositories.is_empty() { return Err(SkipStep(String::from("No repositories to pull")).into()); } print_separator("Git repositories"); - repositories - .bad_patterns - .iter() - .for_each(|pattern| print_warning(format!("Path {pattern} did not contain any git repositories"))); self.multi_pull(repositories, ctx) }