Update protos

Mikayla Maki created

Change summary

crates/collab/src/db.rs        |  8 ++++----
crates/project/src/worktree.rs | 25 +++++++++++++------------
crates/rpc/proto/zed.proto     |  6 +++---
3 files changed, 20 insertions(+), 19 deletions(-)

Detailed changes

crates/collab/src/db.rs 🔗

@@ -1568,8 +1568,8 @@ impl Database {
                                 worktree.updated_repositories.push(proto::RepositoryEntry {
                                     work_directory_id: db_repository.work_directory_id as u64,
                                     branch: db_repository.branch,
-                                    removed_statuses: Default::default(),
-                                    updated_statuses: Default::default(),
+                                    removed_worktree_repo_paths: Default::default(),
+                                    updated_worktree_statuses: Default::default(),
 
                                 });
                             }
@@ -2651,8 +2651,8 @@ impl Database {
                         worktree.repository_entries.push(proto::RepositoryEntry {
                             work_directory_id: db_repository_entry.work_directory_id as u64,
                             branch: db_repository_entry.branch,
-                            removed_statuses: Default::default(),
-                            updated_statuses: Default::default(),
+                            removed_worktree_repo_paths: Default::default(),
+                            updated_worktree_statuses: Default::default(),
 
                         });
                     }

crates/project/src/worktree.rs 🔗

@@ -180,8 +180,8 @@ impl From<&RepositoryEntry> for proto::RepositoryEntry {
             work_directory_id: value.work_directory.to_proto(),
             branch: value.branch.as_ref().map(|str| str.to_string()),
             // TODO: Status
-            removed_statuses: Default::default(),
-            updated_statuses: Default::default(),
+            removed_worktree_repo_paths: Default::default(),
+            updated_worktree_statuses: Default::default(),
         }
     }
 }
@@ -1597,12 +1597,11 @@ impl LocalSnapshot {
     pub(crate) fn repo_for_metadata(
         &self,
         path: &Path,
-    ) -> Option<(ProjectEntryId, Arc<Mutex<dyn GitRepository>>)> {
-        let (entry_id, local_repo) = self
+    ) -> Option<(&ProjectEntryId, &LocalRepositoryEntry)> {
+        self
             .git_repositories
             .iter()
-            .find(|(_, repo)| repo.in_dot_git(path))?;
-        Some((*entry_id, local_repo.repo_ptr.to_owned()))
+            .find(|(_, repo)| repo.in_dot_git(path))
     }
 
     #[cfg(test)]
@@ -2916,13 +2915,19 @@ impl BackgroundScanner {
             .components()
             .any(|component| component.as_os_str() == *DOT_GIT)
         {
-            let (entry_id, repo) = snapshot.repo_for_metadata(&path)?;
+            let (entry_id, repo_ptr) = {
+                let (entry_id, repo) = snapshot.repo_for_metadata(&path)?;
+                if repo.full_scan_id == scan_id {
+                    return None;
+                }
+                (*entry_id, repo.repo_ptr.to_owned())
+            };
 
             let work_dir = snapshot
                 .entry_for_id(entry_id)
                 .map(|entry| RepositoryWorkDirectory(entry.path.clone()))?;
 
-            let repo = repo.lock();
+            let repo = repo_ptr.lock();
             repo.reload_index();
             let branch = repo.branch_name();
             let statuses = repo.worktree_statuses().unwrap_or_default();
@@ -3950,8 +3955,6 @@ mod tests {
         std::fs::remove_file(work_dir.join(B_TXT)).unwrap();
         std::fs::remove_dir_all(work_dir.join("c")).unwrap();
 
-        dbg!(git_status(&repo));
-
         tree.flush_fs_events(cx).await;
 
         // Check that non-repo behavior is tracked
@@ -3959,8 +3962,6 @@ mod tests {
             let snapshot = tree.snapshot();
             let (_, repo) = snapshot.repository_entries.iter().next().unwrap();
 
-            dbg!(&repo.worktree_statuses);
-
             assert_eq!(repo.worktree_statuses.iter().count(), 0);
             assert_eq!(repo.worktree_statuses.get(&Path::new(A_TXT).into()), None);
             assert_eq!(repo.worktree_statuses.get(&Path::new(B_TXT).into()), None);

crates/rpc/proto/zed.proto 🔗

@@ -986,12 +986,12 @@ message Entry {
 message RepositoryEntry {
     uint64 work_directory_id = 1;
     optional string branch = 2;
-    repeated uint64 removed_statuses = 3;
-    repeated StatusEntry updated_statuses = 4;
+    repeated string removed_worktree_repo_paths = 3;
+    repeated StatusEntry updated_worktree_statuses = 4;
 }
 
 message StatusEntry {
-    uint64 entry_id = 1;
+    string repo_path = 1;
     GitStatus status = 2;
 }