Merge pull request #11 from nonnominandus/master
Made a single error message not stall the repo finding process
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -363,8 +363,7 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
if path == root {
|
if path == root {
|
||||||
repo_in_root = true;
|
repo_in_root = true;
|
||||||
}
|
}
|
||||||
let repo = match open_repo(&path, is_worktree) {
|
match open_repo(&path, is_worktree) {
|
||||||
Ok(r) => r,
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_error(&format!(
|
print_error(&format!(
|
||||||
"Error opening repo {}{}: {}",
|
"Error opening repo {}{}: {}",
|
||||||
@@ -375,10 +374,8 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
},
|
},
|
||||||
e
|
e
|
||||||
));
|
));
|
||||||
return None;
|
|
||||||
}
|
}
|
||||||
};
|
Ok(repo) => {
|
||||||
|
|
||||||
let remotes = match repo.remotes() {
|
let remotes = match repo.remotes() {
|
||||||
Ok(remotes) => {
|
Ok(remotes) => {
|
||||||
let mut results: Vec<Remote> = Vec::new();
|
let mut results: Vec<Remote> = Vec::new();
|
||||||
@@ -414,7 +411,6 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
results.push(Remote {
|
results.push(Remote {
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
@@ -424,7 +420,10 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_repo_error(
|
print_repo_error(
|
||||||
&path_as_string(&path),
|
&path_as_string(&path),
|
||||||
&format!("Error getting remote {}: {}", remote_name, e),
|
&format!(
|
||||||
|
"Error getting remote {}: {}",
|
||||||
|
remote_name, e
|
||||||
|
),
|
||||||
);
|
);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
@@ -446,7 +445,6 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
repos.push(Repo {
|
repos.push(Repo {
|
||||||
name: match path == root {
|
name: match path == root {
|
||||||
true => match &root.parent() {
|
true => match &root.parent() {
|
||||||
@@ -462,6 +460,8 @@ fn find_repos(root: &Path) -> Option<(Vec<Repo>, bool)> {
|
|||||||
worktree_setup: is_worktree,
|
worktree_setup: is_worktree,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
Some((repos, repo_in_root))
|
Some((repos, repo_in_root))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user