Warn when no custom git repositories were found (fix #602)

This commit is contained in:
Roey Darwish Dror
2021-01-12 21:18:15 +02:00
parent e31dc52c3a
commit 258acce481

View File

@@ -12,11 +12,11 @@ use log::{debug, error};
use tokio::process::Command as AsyncCommand; use tokio::process::Command as AsyncCommand;
use tokio::runtime; use tokio::runtime;
use crate::error::SkipStep;
use crate::execution_context::ExecutionContext; use crate::execution_context::ExecutionContext;
use crate::executor::{CommandExt, RunType}; use crate::executor::{CommandExt, RunType};
use crate::terminal::print_separator; use crate::terminal::print_separator;
use crate::utils::{which, PathExt}; use crate::utils::{which, PathExt};
use crate::{error::SkipStep, terminal::print_warning};
#[cfg(windows)] #[cfg(windows)]
static PATH_PREFIX: &str = "\\\\?\\"; static PATH_PREFIX: &str = "\\\\?\\";
@@ -30,6 +30,7 @@ pub struct Repositories<'a> {
git: &'a Git, git: &'a Git,
repositories: HashSet<String>, repositories: HashSet<String>,
glob_match_options: MatchOptions, glob_match_options: MatchOptions,
bad_patterns: Vec<String>,
} }
fn check_output(output: Output) -> Result<()> { fn check_output(output: Output) -> Result<()> {
@@ -185,6 +186,10 @@ impl Git {
} }
print_separator("Git repositories"); print_separator("Git repositories");
repositories
.bad_patterns
.iter()
.for_each(|pattern| print_warning(format!("Path {} did not contain any git repositories", pattern)));
self.multi_pull(repositories, ctx) self.multi_pull(repositories, ctx)
} }
@@ -241,6 +246,7 @@ impl<'a> Repositories<'a> {
Self { Self {
git, git,
repositories: HashSet::new(), repositories: HashSet::new(),
bad_patterns: Vec::new(),
glob_match_options, glob_match_options,
} }
} }
@@ -279,6 +285,10 @@ impl<'a> Repositories<'a> {
} }
} }
} }
if last_git_repo.is_none() {
self.bad_patterns.push(String::from(pattern));
}
} else { } else {
error!("Bad glob pattern: {}", pattern); error!("Bad glob pattern: {}", pattern);
} }