beautiful diff

This commit is contained in:
Conrad Irwin 2023-11-01 15:31:37 -06:00
parent cd10ba9e06
commit 90facc051a
5 changed files with 507 additions and 474 deletions

View file

@ -877,14 +877,17 @@ impl Project {
)
});
for path in root_paths {
dbg!(&path);
let (tree, _) = project
.update(cx, |project, cx| {
project.find_or_create_local_worktree(path, true, cx)
})
.await
.unwrap();
dbg!("aaa");
tree.update(cx, |tree, _| tree.as_local().unwrap().scan_complete())
.await;
dbg!("bbb");
}
project
}
@ -5990,8 +5993,10 @@ impl Project {
) -> Task<Result<(Model<Worktree>, PathBuf)>> {
let abs_path = abs_path.as_ref();
if let Some((tree, relative_path)) = self.find_local_worktree(abs_path, cx) {
dbg!("shortcut");
Task::ready(Ok((tree, relative_path)))
} else {
dbg!("long cut");
let worktree = self.create_local_worktree(abs_path, visible, cx);
cx.background_executor()
.spawn(async move { Ok((worktree.await?, PathBuf::new())) })

File diff suppressed because it is too large Load diff

View file

@ -297,11 +297,15 @@ impl Worktree {
// After determining whether the root entry is a file or a directory, populate the
// snapshot's "root name", which will be used for the purpose of fuzzy matching.
let abs_path = path.into();
eprintln!("get root metadata");
let metadata = fs
.metadata(&abs_path)
.await
.context("failed to stat worktree path")?;
eprintln!("got root metadata");
cx.build_model(move |cx: &mut ModelContext<Worktree>| {
let root_name = abs_path
.file_name()