mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 20:22:30 +00:00
Rename weak
to visible
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
a3c8892252
commit
68cfce1fb8
12 changed files with 95 additions and 96 deletions
|
@ -761,7 +761,7 @@ mod tests {
|
|||
|
||||
project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/test", false, cx)
|
||||
project.find_or_create_local_worktree("/test", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -8217,7 +8217,7 @@ mod tests {
|
|||
|
||||
let (worktree, relative_path) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/file", false, cx)
|
||||
project.find_or_create_local_worktree("/file", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -448,7 +448,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -517,7 +517,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir", false, cx)
|
||||
project.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -583,7 +583,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root/the-parent-dir/the-file", false, cx)
|
||||
project.find_or_create_local_worktree("/root/the-parent-dir/the-file", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -485,10 +485,10 @@ impl Project {
|
|||
) -> impl 'a + Iterator<Item = ModelHandle<Worktree>> {
|
||||
self.worktrees.iter().filter_map(|worktree| {
|
||||
worktree.upgrade(cx).and_then(|worktree| {
|
||||
if worktree.read(cx).is_weak() {
|
||||
None
|
||||
} else {
|
||||
if worktree.read(cx).is_visible() {
|
||||
Some(worktree)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -589,7 +589,7 @@ impl Project {
|
|||
for worktree_handle in this.worktrees.iter_mut() {
|
||||
match worktree_handle {
|
||||
WorktreeHandle::Strong(worktree) => {
|
||||
if worktree.read(cx).is_weak() {
|
||||
if !worktree.read(cx).is_visible() {
|
||||
*worktree_handle = WorktreeHandle::Weak(worktree.downgrade());
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ impl Project {
|
|||
} else {
|
||||
let worktree = this
|
||||
.update(&mut cx, |this, cx| {
|
||||
this.create_local_worktree(&abs_path, true, cx)
|
||||
this.create_local_worktree(&abs_path, false, cx)
|
||||
})
|
||||
.await?;
|
||||
this.update(&mut cx, |this, cx| {
|
||||
|
@ -793,7 +793,7 @@ impl Project {
|
|||
abs_path: PathBuf,
|
||||
cx: &mut ModelContext<Project>,
|
||||
) -> Task<Result<()>> {
|
||||
let worktree_task = self.find_or_create_local_worktree(&abs_path, false, cx);
|
||||
let worktree_task = self.find_or_create_local_worktree(&abs_path, true, cx);
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
let (worktree, path) = worktree_task.await?;
|
||||
worktree
|
||||
|
@ -2301,14 +2301,14 @@ impl Project {
|
|||
pub fn find_or_create_local_worktree(
|
||||
&self,
|
||||
abs_path: impl AsRef<Path>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Task<Result<(ModelHandle<Worktree>, PathBuf)>> {
|
||||
let abs_path = abs_path.as_ref();
|
||||
if let Some((tree, relative_path)) = self.find_local_worktree(abs_path, cx) {
|
||||
Task::ready(Ok((tree.clone(), relative_path.into())))
|
||||
} else {
|
||||
let worktree = self.create_local_worktree(abs_path, weak, cx);
|
||||
let worktree = self.create_local_worktree(abs_path, visible, cx);
|
||||
cx.foreground()
|
||||
.spawn(async move { Ok((worktree.await?, PathBuf::new())) })
|
||||
}
|
||||
|
@ -2341,14 +2341,14 @@ impl Project {
|
|||
fn create_local_worktree(
|
||||
&self,
|
||||
abs_path: impl AsRef<Path>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Task<Result<ModelHandle<Worktree>>> {
|
||||
let fs = self.fs.clone();
|
||||
let client = self.client.clone();
|
||||
let path = Arc::from(abs_path.as_ref());
|
||||
cx.spawn(|project, mut cx| async move {
|
||||
let worktree = Worktree::local(client.clone(), path, weak, fs, &mut cx).await?;
|
||||
let worktree = Worktree::local(client.clone(), path, visible, fs, &mut cx).await?;
|
||||
|
||||
let (remote_project_id, is_shared) = project.update(&mut cx, |project, cx| {
|
||||
project.add_worktree(&worktree, cx);
|
||||
|
@ -2394,7 +2394,7 @@ impl Project {
|
|||
|
||||
let push_strong_handle = {
|
||||
let worktree = worktree.read(cx);
|
||||
self.is_shared() || worktree.is_remote()
|
||||
self.is_shared() || worktree.is_visible() || worktree.is_remote()
|
||||
};
|
||||
if push_strong_handle {
|
||||
self.worktrees
|
||||
|
@ -2627,7 +2627,7 @@ impl Project {
|
|||
root_name: envelope.payload.root_name,
|
||||
entries: Default::default(),
|
||||
diagnostic_summaries: Default::default(),
|
||||
weak: envelope.payload.weak,
|
||||
visible: envelope.payload.visible,
|
||||
};
|
||||
let (worktree, load_task) =
|
||||
Worktree::remote(remote_id, replica_id, worktree, client, cx);
|
||||
|
@ -3361,7 +3361,7 @@ impl Project {
|
|||
) -> impl 'a + Future<Output = Vec<PathMatch>> {
|
||||
let worktrees = self
|
||||
.worktrees(cx)
|
||||
.filter(|worktree| !worktree.read(cx).is_weak())
|
||||
.filter(|worktree| worktree.read(cx).is_visible())
|
||||
.collect::<Vec<_>>();
|
||||
let include_root_name = worktrees.len() > 1;
|
||||
let candidate_sets = worktrees
|
||||
|
@ -3656,7 +3656,7 @@ mod tests {
|
|||
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(&root_link_path, false, cx)
|
||||
project.find_or_create_local_worktree(&root_link_path, true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3725,7 +3725,7 @@ mod tests {
|
|||
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir", false, cx)
|
||||
project.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3823,7 +3823,7 @@ mod tests {
|
|||
let project = Project::test(Arc::new(RealFs), cx);
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(&dir.path(), false, cx)
|
||||
project.find_or_create_local_worktree(&dir.path(), true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3871,7 +3871,7 @@ mod tests {
|
|||
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir/b.rs", false, cx)
|
||||
project.find_or_create_local_worktree("/dir/b.rs", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3928,16 +3928,13 @@ mod tests {
|
|||
assert_eq!(definition.range.to_offset(target_buffer), 9..10);
|
||||
assert_eq!(
|
||||
list_worktrees(&project, cx),
|
||||
[("/dir/b.rs".as_ref(), false), ("/dir/a.rs".as_ref(), true)]
|
||||
[("/dir/b.rs".as_ref(), true), ("/dir/a.rs".as_ref(), false)]
|
||||
);
|
||||
|
||||
drop(definition);
|
||||
});
|
||||
cx.read(|cx| {
|
||||
assert_eq!(
|
||||
list_worktrees(&project, cx),
|
||||
[("/dir/b.rs".as_ref(), false)]
|
||||
);
|
||||
assert_eq!(list_worktrees(&project, cx), [("/dir/b.rs".as_ref(), true)]);
|
||||
});
|
||||
|
||||
fn list_worktrees<'a>(
|
||||
|
@ -3951,7 +3948,7 @@ mod tests {
|
|||
let worktree = worktree.read(cx);
|
||||
(
|
||||
worktree.as_local().unwrap().abs_path().as_ref(),
|
||||
worktree.is_weak(),
|
||||
worktree.is_visible(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
@ -3972,7 +3969,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let worktree_id = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
|
@ -4010,7 +4007,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let worktree_id = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir/file1", false, cx)
|
||||
p.find_or_create_local_worktree("/dir/file1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
|
@ -4054,7 +4051,7 @@ mod tests {
|
|||
|
||||
let (tree, _) = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree(dir.path(), false, cx)
|
||||
p.find_or_create_local_worktree(dir.path(), true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4091,7 +4088,7 @@ mod tests {
|
|||
Worktree::remote(
|
||||
1,
|
||||
1,
|
||||
initial_snapshot.to_proto(&Default::default(), Default::default()),
|
||||
initial_snapshot.to_proto(&Default::default(), true),
|
||||
rpc.clone(),
|
||||
cx,
|
||||
)
|
||||
|
@ -4200,7 +4197,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let worktree_id = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree("/the-dir", false, cx)
|
||||
p.find_or_create_local_worktree("/the-dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
|
@ -4250,7 +4247,7 @@ mod tests {
|
|||
let project = Project::test(Arc::new(RealFs), cx);
|
||||
let (worktree, _) = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree(dir.path(), false, cx)
|
||||
p.find_or_create_local_worktree(dir.path(), true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4384,7 +4381,7 @@ mod tests {
|
|||
let project = Project::test(Arc::new(RealFs), cx);
|
||||
let (worktree, _) = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree(dir.path(), false, cx)
|
||||
p.find_or_create_local_worktree(dir.path(), true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4493,7 +4490,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let (worktree, _) = project
|
||||
.update(cx, |p, cx| {
|
||||
p.find_or_create_local_worktree("/the-dir", false, cx)
|
||||
p.find_or_create_local_worktree("/the-dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4761,7 +4758,7 @@ mod tests {
|
|||
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir", false, cx)
|
||||
project.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4889,7 +4886,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir", false, cx)
|
||||
project.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -71,7 +71,7 @@ pub struct LocalWorktree {
|
|||
queued_operations: Vec<(u64, Operation)>,
|
||||
client: Arc<Client>,
|
||||
fs: Arc<dyn Fs>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
}
|
||||
|
||||
pub struct RemoteWorktree {
|
||||
|
@ -83,7 +83,7 @@ pub struct RemoteWorktree {
|
|||
replica_id: ReplicaId,
|
||||
queued_operations: Vec<(u64, Operation)>,
|
||||
diagnostic_summaries: TreeMap<PathKey, DiagnosticSummary>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -169,11 +169,12 @@ impl Worktree {
|
|||
pub async fn local(
|
||||
client: Arc<Client>,
|
||||
path: impl Into<Arc<Path>>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
fs: Arc<dyn Fs>,
|
||||
cx: &mut AsyncAppContext,
|
||||
) -> Result<ModelHandle<Self>> {
|
||||
let (tree, scan_states_tx) = LocalWorktree::new(client, path, weak, fs.clone(), cx).await?;
|
||||
let (tree, scan_states_tx) =
|
||||
LocalWorktree::new(client, path, visible, fs.clone(), cx).await?;
|
||||
tree.update(cx, |tree, cx| {
|
||||
let tree = tree.as_local_mut().unwrap();
|
||||
let abs_path = tree.abs_path().clone();
|
||||
|
@ -203,7 +204,7 @@ impl Worktree {
|
|||
.map(|c| c.to_ascii_lowercase())
|
||||
.collect();
|
||||
let root_name = worktree.root_name.clone();
|
||||
let weak = worktree.weak;
|
||||
let visible = worktree.visible;
|
||||
let snapshot = Snapshot {
|
||||
id: WorktreeId(remote_id as usize),
|
||||
root_name,
|
||||
|
@ -236,7 +237,7 @@ impl Worktree {
|
|||
)
|
||||
}),
|
||||
),
|
||||
weak,
|
||||
visible,
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -356,10 +357,10 @@ impl Worktree {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_weak(&self) -> bool {
|
||||
pub fn is_visible(&self) -> bool {
|
||||
match self {
|
||||
Worktree::Local(worktree) => worktree.weak,
|
||||
Worktree::Remote(worktree) => worktree.weak,
|
||||
Worktree::Local(worktree) => worktree.visible,
|
||||
Worktree::Remote(worktree) => worktree.visible,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +459,7 @@ impl LocalWorktree {
|
|||
async fn new(
|
||||
client: Arc<Client>,
|
||||
path: impl Into<Arc<Path>>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
fs: Arc<dyn Fs>,
|
||||
cx: &mut AsyncAppContext,
|
||||
) -> Result<(ModelHandle<Worktree>, UnboundedSender<ScanState>)> {
|
||||
|
@ -525,7 +526,7 @@ impl LocalWorktree {
|
|||
queued_operations: Default::default(),
|
||||
client,
|
||||
fs,
|
||||
weak,
|
||||
visible,
|
||||
};
|
||||
|
||||
cx.spawn_weak(|this, mut cx| async move {
|
||||
|
@ -738,7 +739,7 @@ impl LocalWorktree {
|
|||
worktree_id: self.id().to_proto(),
|
||||
root_name: self.root_name().to_string(),
|
||||
authorized_logins: self.authorized_logins(),
|
||||
weak: self.weak,
|
||||
visible: self.visible,
|
||||
};
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
let response = client.request(register_message).await;
|
||||
|
@ -1028,7 +1029,7 @@ impl LocalSnapshot {
|
|||
pub(crate) fn to_proto(
|
||||
&self,
|
||||
diagnostic_summaries: &TreeMap<PathKey, DiagnosticSummary>,
|
||||
weak: bool,
|
||||
visible: bool,
|
||||
) -> proto::Worktree {
|
||||
let root_name = self.root_name.clone();
|
||||
proto::Worktree {
|
||||
|
@ -1044,7 +1045,7 @@ impl LocalSnapshot {
|
|||
.iter()
|
||||
.map(|(path, summary)| summary.to_proto(&path.0))
|
||||
.collect(),
|
||||
weak,
|
||||
visible,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2468,7 +2469,7 @@ mod tests {
|
|||
let tree = Worktree::local(
|
||||
client,
|
||||
Arc::from(Path::new("/root")),
|
||||
false,
|
||||
true,
|
||||
fs,
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -2511,7 +2512,7 @@ mod tests {
|
|||
let tree = Worktree::local(
|
||||
client,
|
||||
dir.path(),
|
||||
false,
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
|
|
@ -327,7 +327,7 @@ impl ProjectPanel {
|
|||
.project
|
||||
.read(cx)
|
||||
.worktrees(cx)
|
||||
.filter(|worktree| !worktree.read(cx).is_weak());
|
||||
.filter(|worktree| worktree.read(cx).is_visible());
|
||||
self.visible_entries.clear();
|
||||
|
||||
let mut entry_ix = 0;
|
||||
|
@ -642,7 +642,7 @@ mod tests {
|
|||
});
|
||||
let (root1, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root1", false, cx)
|
||||
project.find_or_create_local_worktree("/root1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -651,7 +651,7 @@ mod tests {
|
|||
.await;
|
||||
let (root2, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root2", false, cx)
|
||||
project.find_or_create_local_worktree("/root2", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -134,7 +134,7 @@ message RegisterWorktree {
|
|||
uint64 worktree_id = 2;
|
||||
string root_name = 3;
|
||||
repeated string authorized_logins = 4;
|
||||
bool weak = 5;
|
||||
bool visible = 5;
|
||||
}
|
||||
|
||||
message UnregisterWorktree {
|
||||
|
@ -502,7 +502,7 @@ message Worktree {
|
|||
string root_name = 2;
|
||||
repeated Entry entries = 3;
|
||||
repeated DiagnosticSummary diagnostic_summaries = 4;
|
||||
bool weak = 5;
|
||||
bool visible = 5;
|
||||
}
|
||||
|
||||
message File {
|
||||
|
|
|
@ -735,7 +735,7 @@ mod tests {
|
|||
let project = Project::test(fs.clone(), cx);
|
||||
let (tree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir", false, cx)
|
||||
project.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
@ -351,7 +351,7 @@ impl Server {
|
|||
.values()
|
||||
.cloned()
|
||||
.collect(),
|
||||
weak: worktree.weak,
|
||||
visible: worktree.visible,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
@ -440,7 +440,7 @@ impl Server {
|
|||
Worktree {
|
||||
authorized_user_ids: contact_user_ids.clone(),
|
||||
root_name: request.payload.root_name.clone(),
|
||||
weak: request.payload.weak,
|
||||
visible: request.payload.visible,
|
||||
},
|
||||
)?;
|
||||
}
|
||||
|
@ -1070,7 +1070,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1202,7 +1202,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1303,7 +1303,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1475,7 +1475,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1557,7 +1557,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1638,7 +1638,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1717,7 +1717,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1790,7 +1790,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1878,7 +1878,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2104,7 +2104,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2303,7 +2303,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2409,7 +2409,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root-1", false, cx)
|
||||
p.find_or_create_local_worktree("/root-1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2545,7 +2545,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root-1", false, cx)
|
||||
p.find_or_create_local_worktree("/root-1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2666,7 +2666,7 @@ mod tests {
|
|||
|
||||
let (worktree_1, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root-1", false, cx)
|
||||
p.find_or_create_local_worktree("/root-1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2675,7 +2675,7 @@ mod tests {
|
|||
.await;
|
||||
let (worktree_2, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root-2", false, cx)
|
||||
p.find_or_create_local_worktree("/root-2", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2775,7 +2775,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root-1", false, cx)
|
||||
p.find_or_create_local_worktree("/root-1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -2921,7 +2921,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/code/crate-1", false, cx)
|
||||
p.find_or_create_local_worktree("/code/crate-1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3051,7 +3051,7 @@ mod tests {
|
|||
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/root", false, cx)
|
||||
p.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3155,7 +3155,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -3391,7 +3391,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/dir", false, cx)
|
||||
p.find_or_create_local_worktree("/dir", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4005,7 +4005,7 @@ mod tests {
|
|||
});
|
||||
let (worktree_a, _) = project_a
|
||||
.update(cx_a, |p, cx| {
|
||||
p.find_or_create_local_worktree("/a", false, cx)
|
||||
p.find_or_create_local_worktree("/a", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4165,7 +4165,7 @@ mod tests {
|
|||
|
||||
let (collab_worktree, _) = host_project
|
||||
.update(&mut host_cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/_collab", false, cx)
|
||||
project.find_or_create_local_worktree("/_collab", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4662,7 +4662,7 @@ mod tests {
|
|||
log::info!("Host: find/create local worktree {:?}", path);
|
||||
project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(path, false, cx)
|
||||
project.find_or_create_local_worktree(path, true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -4674,7 +4674,7 @@ mod tests {
|
|||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(
|
||||
file.clone(),
|
||||
false,
|
||||
true,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
|
@ -4769,7 +4769,8 @@ mod tests {
|
|||
.worktrees(&cx)
|
||||
.filter(|worktree| {
|
||||
let worktree = worktree.read(cx);
|
||||
!worktree.is_weak() && worktree.entries(false).any(|e| e.is_file())
|
||||
worktree.is_visible()
|
||||
&& worktree.entries(false).any(|e| e.is_file())
|
||||
})
|
||||
.choose(&mut *rng.lock())
|
||||
}) {
|
||||
|
|
|
@ -30,7 +30,7 @@ pub struct Project {
|
|||
pub struct Worktree {
|
||||
pub authorized_user_ids: Vec<UserId>,
|
||||
pub root_name: String,
|
||||
pub weak: bool,
|
||||
pub visible: bool,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -204,7 +204,7 @@ impl Store {
|
|||
let mut worktree_root_names = project
|
||||
.worktrees
|
||||
.values()
|
||||
.filter(|worktree| !worktree.weak)
|
||||
.filter(|worktree| worktree.visible)
|
||||
.map(|worktree| worktree.root_name.clone())
|
||||
.collect::<Vec<_>>();
|
||||
worktree_root_names.sort_unstable();
|
||||
|
|
|
@ -737,7 +737,7 @@ impl Workspace {
|
|||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<Result<ProjectPath>> {
|
||||
let entry = self.project().update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(abs_path, false, cx)
|
||||
project.find_or_create_local_worktree(abs_path, true, cx)
|
||||
});
|
||||
cx.spawn(|_, cx| async move {
|
||||
let (worktree, path) = entry.await?;
|
||||
|
|
|
@ -257,7 +257,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -370,7 +370,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/dir1", false, cx)
|
||||
project.find_or_create_local_worktree("/dir1", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -445,7 +445,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -492,7 +492,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -644,7 +644,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -707,7 +707,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
project.find_or_create_local_worktree("/root", true, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Reference in a new issue