Ensure worktree is registered/shared synchronously

This commit is contained in:
Antonio Scandurra 2022-03-03 10:10:53 +01:00
parent 530f15b46b
commit 53327e2bf0
3 changed files with 61 additions and 42 deletions

View file

@ -2396,17 +2396,18 @@ impl Project {
});
if let Some(project_id) = remote_project_id {
worktree
.update(&mut cx, |worktree, cx| {
worktree.as_local_mut().unwrap().register(project_id, cx)
})
.await?;
if is_shared {
worktree
.update(&mut cx, |worktree, cx| {
worktree.as_local_mut().unwrap().share(project_id, cx)
})
.await?;
} else {
worktree
.update(&mut cx, |worktree, cx| {
worktree.as_local_mut().unwrap().register(project_id, cx)
})
.await?;
}
}