Handle buffer diff base updates and file renames properly for SSH projects (#14989)

Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-07-23 11:32:37 -07:00 committed by GitHub
parent ec093c390f
commit 38e3182bef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 1021 additions and 811 deletions

View file

@ -1496,7 +1496,7 @@ async fn test_search_results_refreshed_on_adding_and_removing_worktrees(
let project = Project::test(app_state.fs.clone(), ["/test/project_1".as_ref()], cx).await;
let (workspace, cx) = cx.add_window_view(|cx| Workspace::test_new(project.clone(), cx));
let worktree_1_id = project.update(cx, |project, cx| {
let worktree = project.worktrees().last().expect("worktree not found");
let worktree = project.worktrees(cx).last().expect("worktree not found");
worktree.read(cx).id()
});

View file

@ -32,7 +32,7 @@ impl Match {
path_match.path.join(suffix),
)
} else {
(project.worktrees().next(), PathBuf::from(suffix))
(project.worktrees(cx).next(), PathBuf::from(suffix))
};
worktree.and_then(|worktree| worktree.read(cx).entry_for_path(path))
@ -72,7 +72,7 @@ impl Match {
let worktree_id = if let Some(path_match) = &self.path_match {
WorktreeId::from_usize(path_match.worktree_id)
} else {
project.worktrees().next()?.read(cx).id()
project.worktrees(cx).next()?.read(cx).id()
};
let path = PathBuf::from(self.relative_path());
@ -84,7 +84,7 @@ impl Match {
}
fn existing_prefix(&self, project: &Project, cx: &WindowContext) -> Option<PathBuf> {
let worktree = project.worktrees().next()?.read(cx);
let worktree = project.worktrees(cx).next()?.read(cx);
let mut prefix = PathBuf::new();
let parts = self.suffix.as_ref()?.split('/');
for part in parts {