Ensure worktree updates are applied in order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
28ba49b47b
commit
8d06049124
@@ -339,6 +339,7 @@ impl Server {
|
||||
.cloned()
|
||||
.collect(),
|
||||
weak: worktree.weak,
|
||||
next_update_id: share.next_update_id as u64,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -477,6 +478,7 @@ impl Server {
|
||||
request.sender_id,
|
||||
entries,
|
||||
diagnostic_summaries,
|
||||
worktree.next_update_id,
|
||||
)?;
|
||||
|
||||
broadcast(
|
||||
@@ -1115,7 +1117,7 @@ mod tests {
|
||||
LanguageConfig, LanguageRegistry, LanguageServerConfig, Point,
|
||||
},
|
||||
lsp,
|
||||
project::{worktree::WorktreeHandle, DiagnosticSummary, Project, ProjectPath},
|
||||
project::{DiagnosticSummary, Project, ProjectPath},
|
||||
workspace::{Workspace, WorkspaceParams},
|
||||
};
|
||||
|
||||
@@ -1486,11 +1488,6 @@ mod tests {
|
||||
buffer_b.read_with(&cx_b, |buf, _| assert!(!buf.is_dirty()));
|
||||
buffer_c.condition(&cx_c, |buf, _| !buf.is_dirty()).await;
|
||||
|
||||
// Ensure worktree observes a/file1's change event *before* the rename occurs, otherwise
|
||||
// when interpreting the change event it will mistakenly think that the file has been
|
||||
// deleted (because its path has changed) and will subsequently fail to detect the rename.
|
||||
worktree_a.flush_fs_events(&cx_a).await;
|
||||
|
||||
// Make changes on host's file system, see those changes on guest worktrees.
|
||||
fs.rename(
|
||||
"/a/file1".as_ref(),
|
||||
@@ -1499,6 +1496,7 @@ mod tests {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
fs.rename("/a/file2".as_ref(), "/a/file3".as_ref(), Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -43,6 +43,7 @@ pub struct ProjectShare {
|
||||
pub struct WorktreeShare {
|
||||
pub entries: HashMap<u64, proto::Entry>,
|
||||
pub diagnostic_summaries: BTreeMap<PathBuf, proto::DiagnosticSummary>,
|
||||
pub next_update_id: u64,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -403,6 +404,7 @@ impl Store {
|
||||
connection_id: ConnectionId,
|
||||
entries: HashMap<u64, proto::Entry>,
|
||||
diagnostic_summaries: BTreeMap<PathBuf, proto::DiagnosticSummary>,
|
||||
next_update_id: u64,
|
||||
) -> tide::Result<SharedWorktree> {
|
||||
let project = self
|
||||
.projects
|
||||
@@ -416,6 +418,7 @@ impl Store {
|
||||
worktree.share = Some(WorktreeShare {
|
||||
entries,
|
||||
diagnostic_summaries,
|
||||
next_update_id,
|
||||
});
|
||||
Ok(SharedWorktree {
|
||||
authorized_user_ids: project.authorized_user_ids(),
|
||||
|
||||
Reference in New Issue
Block a user