aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-22 20:40:16 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-22 20:40:16 -0600
commit3905b6ff0c6bdf11290ea8bd1c920b4d14b6f8ca (patch)
tree8f16d8c3240e4ef26e82027b850e6cbaceeda9bc /src
parent2988da14bed5f628cf4cd90eca0eec3c11f0c061 (diff)
downloadgityeet-3905b6ff0c6bdf11290ea8bd1c920b4d14b6f8ca.tar.gz
gityeet-3905b6ff0c6bdf11290ea8bd1c920b4d14b6f8ca.zip
appease the paperclip
Diffstat (limited to 'src')
-rw-r--r--src/state.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/state.rs b/src/state.rs
index 475302b..645a4b6 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -16,18 +16,15 @@ fn find_repos_in(dir: impl AsRef<Path>) -> Result<Vec<Repository>> {
let dir = read_dir(dir)?;
let mut result = vec![];
for subdir in dir {
- match subdir {
- Ok(subdir) => {
- 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())?)
- }
- // TODO handle in a non-god-awful way
- Err(err) => panic!("{}", err),
+ if let Ok(subdir) = subdir {
+ 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())?)
}
+ // TODO handle in a non-god-awful way
+ Err(err) => panic!("{}", err),
}
- Err(_) => {},
}
}
Ok(result)
@@ -41,6 +38,6 @@ impl State {
}
pub fn relative_path<'a>(&'a self, subdir: &'a Path) -> &'a Path {
- subdir.strip_prefix(&self.root).unwrap_or_else(|_| subdir.as_ref())
+ subdir.strip_prefix(&self.root).unwrap_or(subdir)
}
}