diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-22 20:56:59 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-22 20:56:59 -0600 |
commit | 66a0f6cb6592eedc6c357f3bb02840dc93e7d05d (patch) | |
tree | a82aa63d30b4f13312021ccf6ee745c13100dd0b /src | |
parent | 0ff740af7ea469270ac8f90782e291ce53050f1f (diff) | |
download | gityeet-66a0f6cb6592eedc6c357f3bb02840dc93e7d05d.tar.gz gityeet-66a0f6cb6592eedc6c357f3bb02840dc93e7d05d.zip |
only recurse into actual directories
Diffstat (limited to 'src')
-rw-r--r-- | src/state.rs | 7 |
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), |