aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/state.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/state.rs b/src/state.rs
index ed7f196..9a2488b 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -1,4 +1,4 @@
-use std::fs::read_dir;
+use std::fs::{metadata, read_dir};
use std::io;
use std::path::{Path, PathBuf};
@@ -26,7 +26,10 @@ fn find_repos_in(dir: impl AsRef<Path>) -> Result<Vec<Repository>> {
match Repository::open_bare(subdir.path()) {
Ok(repo) => result.push(repo),
Err(err) if err.class() == git2::ErrorClass::Repository && err.code() == git2::ErrorCode::NotFound => {
- result.extend(find_repos_in(subdir.path())?)
+ let metadata = metadata(subdir.path())?;
+ if metadata.is_dir() {
+ result.extend(find_repos_in(subdir.path())?)
+ }
}
// TODO handle in a non-god-awful way
Err(err) => panic!("{}", err),