Merge pull request #11 from nonnominandus/master

Made a single error message not stall the repo finding process
This commit is contained in:
2021-11-30 09:50:04 +01:00
committed by GitHub

View File

@@ -363,8 +363,7 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
if path == root {
repo_in_root = true;
}
let repo = match open_repo(&path, is_worktree) {
Ok(r) => r,
match open_repo(&path, is_worktree) {
Err(e) => {
print_error(&format!(
"Error opening repo {}{}: {}",
@@ -375,10 +374,8 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
},
e
));
return None;
}
};
Ok(repo) => {
let remotes = match repo.remotes() {
Ok(remotes) => {
let mut results: Vec<Remote> = Vec::new();
@@ -414,7 +411,6 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
process::exit(1);
}
};
results.push(Remote {
name,
url,
@@ -424,7 +420,10 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
Err(e) => {
print_repo_error(
&path_as_string(&path),
&format!("Error getting remote {}: {}", remote_name, e),
&format!(
"Error getting remote {}: {}",
remote_name, e
),
);
process::exit(1);
}
@@ -446,7 +445,6 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
process::exit(1);
}
};
repos.push(Repo {
name: match path == root {
true => match &root.parent() {
@@ -462,6 +460,8 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
worktree_setup: is_worktree,
});
}
};
}
Some((repos, repo_in_root))
}