Do not panic on non-worktree file indexing
This commit is contained in:
parent
4e544545d1
commit
7e21e0f0eb
1 changed files with 13 additions and 6 deletions
|
@ -963,12 +963,19 @@ impl LocalWorktree {
|
||||||
let mut index_task = None;
|
let mut index_task = None;
|
||||||
let snapshot = this.read_with(&cx, |this, _| this.as_local().unwrap().snapshot());
|
let snapshot = this.read_with(&cx, |this, _| this.as_local().unwrap().snapshot());
|
||||||
if let Some(repo) = snapshot.repository_for_path(&path) {
|
if let Some(repo) = snapshot.repository_for_path(&path) {
|
||||||
let repo_path = repo.work_directory.relativize(&snapshot, &path).unwrap();
|
if let Some(repo_path) = repo.work_directory.relativize(&snapshot, &path) {
|
||||||
if let Some(repo) = snapshot.git_repositories.get(&*repo.work_directory) {
|
if let Some(repo) = snapshot.git_repositories.get(&*repo.work_directory) {
|
||||||
let repo = repo.repo_ptr.clone();
|
let repo = repo.repo_ptr.clone();
|
||||||
index_task = Some(
|
index_task = Some(
|
||||||
cx.background()
|
cx.background()
|
||||||
.spawn(async move { repo.lock().load_index_text(&repo_path) }),
|
.spawn(async move { repo.lock().load_index_text(&repo_path) }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log::warn!(
|
||||||
|
"Skipping loading index text from path {:?} is not in repository {:?}",
|
||||||
|
path,
|
||||||
|
repo.work_directory,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue