Remove weak worktrees from project when nobody references them

Also, avoid showing them in the project panel as well as in the
contacts panel.
This commit is contained in:
Antonio Scandurra
2022-01-21 14:34:14 +01:00
parent ee95775b1c
commit 6e7e86e491
10 changed files with 261 additions and 170 deletions
+2
View File
@@ -31,6 +31,7 @@ pub struct Worktree {
pub authorized_user_ids: Vec<UserId>,
pub root_name: String,
pub share: Option<WorktreeShare>,
pub weak: bool,
}
#[derive(Default)]
@@ -202,6 +203,7 @@ impl Store {
let mut worktree_root_names = project
.worktrees
.values()
.filter(|worktree| !worktree.weak)
.map(|worktree| worktree.root_name.clone())
.collect::<Vec<_>>();
worktree_root_names.sort_unstable();