Merge pull request #1223 from zed-industries/update-metadata-when-worktrees-are-removed
Update project metadata when releasing a worktree's weak handle
This commit is contained in:
@@ -4088,16 +4088,17 @@ impl Project {
|
|||||||
self.worktrees
|
self.worktrees
|
||||||
.push(WorktreeHandle::Strong(worktree.clone()));
|
.push(WorktreeHandle::Strong(worktree.clone()));
|
||||||
} else {
|
} else {
|
||||||
cx.observe_release(&worktree, |this, _, cx| {
|
|
||||||
this.worktrees
|
|
||||||
.retain(|worktree| worktree.upgrade(cx).is_some());
|
|
||||||
cx.notify();
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
self.worktrees
|
self.worktrees
|
||||||
.push(WorktreeHandle::Weak(worktree.downgrade()));
|
.push(WorktreeHandle::Weak(worktree.downgrade()));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.metadata_changed(true, cx);
|
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.emit(Event::WorktreeAdded);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user