From a3a9d024ba3323ae4b67e2dea4ecfb88ce6a489b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Sat, 22 Jul 2023 17:53:58 -0700 Subject: [PATCH] Fix filtering of staged statuses --- crates/fs/src/repository.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/fs/src/repository.rs b/crates/fs/src/repository.rs index 47e1bc1aab..f4678d933f 100644 --- a/crates/fs/src/repository.rs +++ b/crates/fs/src/repository.rs @@ -101,18 +101,17 @@ impl GitRepository for LibGitRepository { let mut options = git2::StatusOptions::new(); options.pathspec(path_prefix); options.disable_pathspec_match(true); + options.show(StatusShow::Index); if let Some(statuses) = self.statuses(Some(&mut options)).log_err() { - for status in statuses - .iter() - .filter(|status| !status.status().contains(git2::Status::IGNORED)) - { + for status in statuses.iter() { let path = RepoPath(PathBuf::from(OsStr::from_bytes(status.path_bytes()))); - let Some(status) = read_status(status.status()) else { - continue - }; - - map.insert(path, status) + let status = status.status(); + if !status.contains(git2::Status::IGNORED) { + if let Some(status) = read_status(status) { + map.insert(path, status) + } + } } } map