Move git status out of Entry (#22224)
- [x] Rewrite worktree git handling - [x] Fix tests - [x] Fix `test_propagate_statuses_for_repos_under_project` - [x] Replace `WorkDirectoryEntry` with `WorkDirectory` in `RepositoryEntry` - [x] Add a worktree event for capturing git status changes - [x] Confirm that the local repositories are correctly updating the new WorkDirectory field - [x] Implement the git statuses query as a join when pulling entries out of worktree - [x] Use this new join to implement the project panel and outline panel. - [x] Synchronize git statuses over the wire for collab and remote dev (use the existing `worktree_repository_statuses` table, adjust as needed) - [x] Only send changed statuses to collab Release Notes: - N/A --------- Co-authored-by: Cole Miller <cole@zed.dev> Co-authored-by: Mikayla <mikayla@zed.com> Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
co-authored by
Cole Miller
Mikayla
Nathan
parent
72057e5716
commit
9613084f59
@@ -62,6 +62,7 @@ pub enum WorktreeStoreEvent {
|
||||
WorktreeReleased(EntityId, WorktreeId),
|
||||
WorktreeOrderChanged,
|
||||
WorktreeUpdateSent(Model<Worktree>),
|
||||
GitRepositoryUpdated,
|
||||
}
|
||||
|
||||
impl EventEmitter<WorktreeStoreEvent> for WorktreeStore {}
|
||||
@@ -322,6 +323,7 @@ impl WorktreeStore {
|
||||
let worktree = Worktree::local(path.clone(), visible, fs, next_entry_id, &mut cx).await;
|
||||
|
||||
let worktree = worktree?;
|
||||
|
||||
this.update(&mut cx, |this, cx| this.add(&worktree, cx))?;
|
||||
|
||||
if visible {
|
||||
@@ -374,6 +376,17 @@ impl WorktreeStore {
|
||||
this.send_project_updates(cx);
|
||||
})
|
||||
.detach();
|
||||
|
||||
cx.subscribe(
|
||||
worktree,
|
||||
|_this, _, event: &worktree::Event, cx| match event {
|
||||
worktree::Event::UpdatedGitRepositories(_) => {
|
||||
cx.emit(WorktreeStoreEvent::GitRepositoryUpdated);
|
||||
}
|
||||
worktree::Event::DeletedEntry(_) | worktree::Event::UpdatedEntries(_) => {}
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
}
|
||||
|
||||
pub fn remove_worktree(&mut self, id_to_remove: WorktreeId, cx: &mut ModelContext<Self>) {
|
||||
@@ -583,11 +596,11 @@ impl WorktreeStore {
|
||||
pub fn shared(
|
||||
&mut self,
|
||||
remote_id: u64,
|
||||
downsteam_client: AnyProtoClient,
|
||||
downstream_client: AnyProtoClient,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) {
|
||||
self.retain_worktrees = true;
|
||||
self.downstream_client = Some((downsteam_client, remote_id));
|
||||
self.downstream_client = Some((downstream_client, remote_id));
|
||||
|
||||
// When shared, retain all worktrees
|
||||
for worktree_handle in self.worktrees.iter_mut() {
|
||||
|
||||
Reference in New Issue
Block a user