Fix a bug that prevented repositories from being deduplicated (#27884)

Closes #ISSUE

Release Notes:

- Ensure that only one repository is shown in the git UI when two
subdirectories of a repository root are open in Zed
This commit is contained in:
Cole Miller 2025-04-01 18:41:01 -04:00 committed by GitHub
parent 8321e65561
commit 6262a4638b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 1 deletions

View file

@ -1062,8 +1062,12 @@ impl GitStore {
let mut removed_ids = Vec::new();
for update in updated_git_repositories.iter() {
if let Some((id, existing)) = self.repositories.iter().find(|(_, repo)| {
Some(&repo.read(cx).work_directory_abs_path)
let existing_work_directory_abs_path =
repo.read(cx).work_directory_abs_path.clone();
Some(&existing_work_directory_abs_path)
== update.old_work_directory_abs_path.as_ref()
|| Some(&existing_work_directory_abs_path)
== update.new_work_directory_abs_path.as_ref()
}) {
if let Some(new_work_directory_abs_path) =
update.new_work_directory_abs_path.clone()