From c12bdc894a8e475a1aa07779c107f47eb39a3c68 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 5 Jun 2023 15:19:59 -0700 Subject: [PATCH] Silence not found errors --- crates/fs/src/repository.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/fs/src/repository.rs b/crates/fs/src/repository.rs index efe3a40092..488262887f 100644 --- a/crates/fs/src/repository.rs +++ b/crates/fs/src/repository.rs @@ -1,5 +1,6 @@ use anyhow::Result; use collections::HashMap; +use git2::ErrorCode; use parking_lot::Mutex; use rpc::proto; use serde_derive::{Deserialize, Serialize}; @@ -93,8 +94,17 @@ impl GitRepository for LibGitRepository { } fn status(&self, path: &RepoPath) -> Result> { - let status = self.status_file(path)?; - Ok(read_status(status)) + let status = self.status_file(path); + match status { + Ok(status) => Ok(read_status(status)), + Err(e) => { + if e.code() == ErrorCode::NotFound { + Ok(None) + } else { + Err(e.into()) + } + } + } } }