mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-25 19:29:49 +00:00
Update project metadata when releasing a worktree's weak handle
When a project was getting unshared, we would remove invisible worktrees from the project's state without notifying the server, which was causing the randomized tests to fail. This commit calls `Project::remove_worktree` when a worktree's handle gets released. Doing so ensures that we update both our local metadata database as well as the state on the server.
This commit is contained in:
parent
484e98c0bb
commit
2f09a4af16
1 changed files with 7 additions and 6 deletions
|
@ -4088,16 +4088,17 @@ impl Project {
|
|||
self.worktrees
|
||||
.push(WorktreeHandle::Strong(worktree.clone()));
|
||||
} else {
|
||||
cx.observe_release(&worktree, |this, _, cx| {
|
||||
this.worktrees
|
||||
.retain(|worktree| worktree.upgrade(cx).is_some());
|
||||
cx.notify();
|
||||
})
|
||||
.detach();
|
||||
self.worktrees
|
||||
.push(WorktreeHandle::Weak(worktree.downgrade()));
|
||||
}
|
||||
|
||||
self.metadata_changed(true, cx);
|
||||
cx.observe_release(&worktree, |this, worktree, cx| {
|
||||
this.remove_worktree(worktree.id(), cx);
|
||||
cx.notify();
|
||||
})
|
||||
.detach();
|
||||
|
||||
cx.emit(Event::WorktreeAdded);
|
||||
cx.notify();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue