WIP: Add status bubbling to project panel

This commit is contained in:
Mikayla Maki 2023-06-05 12:53:04 -07:00
parent 49c5a3fa86
commit 9a13a2ba2c
No known key found for this signature in database
3 changed files with 54 additions and 26 deletions

View file

@ -25,7 +25,7 @@ pub trait GitRepository: Send {
fn statuses(&self) -> Option<TreeMap<RepoPath, GitFileStatus>>;
fn status(&self, path: &RepoPath) -> Option<GitFileStatus>;
fn status(&self, path: &RepoPath) -> Result<Option<GitFileStatus>>;
}
impl std::fmt::Debug for dyn GitRepository {
@ -92,9 +92,9 @@ impl GitRepository for LibGitRepository {
Some(map)
}
fn status(&self, path: &RepoPath) -> Option<GitFileStatus> {
let status = self.status_file(path).log_err()?;
read_status(status)
fn status(&self, path: &RepoPath) -> Result<Option<GitFileStatus>> {
let status = self.status_file(path)?;
Ok(read_status(status))
}
}
@ -156,9 +156,9 @@ impl GitRepository for FakeGitRepository {
Some(map)
}
fn status(&self, path: &RepoPath) -> Option<GitFileStatus> {
fn status(&self, path: &RepoPath) -> Result<Option<GitFileStatus>> {
let state = self.state.lock();
state.worktree_statuses.get(path).cloned()
Ok(state.worktree_statuses.get(path).cloned())
}
}