Reload git index on file events to catch new contents

This commit is contained in:
Julia 2022-10-05 16:28:01 -04:00
parent 3f4be5521c
commit 771215d254
4 changed files with 17 additions and 8 deletions

View file

@ -4684,7 +4684,7 @@ impl Project {
cx.spawn(|_, mut cx| async move {
let diff_base = cx
.background()
.spawn(async move { repo.repo.lock().load_index(&relative_repo) })
.spawn(async move { repo.repo.lock().load_index_text(&relative_repo) })
.await;
let buffer_id = buffer.update(&mut cx, |buffer, cx| {

View file

@ -671,7 +671,7 @@ impl LocalWorktree {
if let Ok(repo_relative) = path.strip_prefix(repo.content_path) {
let repo_relative = repo_relative.to_owned();
cx.background()
.spawn(async move { repo.repo.lock().load_index(&repo_relative) })
.spawn(async move { repo.repo.lock().load_index_text(&repo_relative) })
.await
} else {
None
@ -2505,6 +2505,7 @@ impl BackgroundScanner {
let scan_id = snapshot.scan_id;
if let Some(repo) = snapshot.in_dot_git(&path) {
repo.repo.lock().reload_index();
repo.scan_id = scan_id;
}