Build again

Julia created

Change summary

crates/language/src/buffer.rs        |  3 +--
crates/project/src/git_repository.rs |  2 +-
crates/project/src/worktree.rs       | 12 ++++++------
3 files changed, 8 insertions(+), 9 deletions(-)

Detailed changes

crates/language/src/buffer.rs 🔗

@@ -662,10 +662,9 @@ impl Buffer {
         self.file = Some(new_file);
         task
     }
-    
+
     pub fn update_git(&mut self, cx: &mut ModelContext<Self>) {
         //Grab head text
-        
 
         self.git_diff_recalc(cx);
     }

crates/project/src/git_repository.rs 🔗

@@ -1,7 +1,7 @@
 use anyhow::Result;
 use git2::{Repository as LibGitRepository, RepositoryOpenFlags as LibGitRepositoryOpenFlags};
 use parking_lot::Mutex;
-use std::{path::Path, sync::Arc, ffi::OsStr};
+use std::{ffi::OsStr, path::Path, sync::Arc};
 use util::ResultExt;
 
 #[derive(Clone)]

crates/project/src/worktree.rs 🔗

@@ -636,6 +636,7 @@ impl LocalWorktree {
         let path = Arc::from(path);
         let abs_path = self.absolutize(&path);
         let fs = self.fs.clone();
+        let snapshot = self.snapshot();
 
         let files_included = cx
             .global::<Settings>()
@@ -651,12 +652,11 @@ impl LocalWorktree {
                 files_included,
                 settings::GitFilesIncluded::All | settings::GitFilesIncluded::OnlyTracked
             ) {
-                
-                
-                let fs = fs.clone();
-                let abs_path = abs_path.clone();
-                let opt_future = async move { fs.load_head_text(&abs_path).await };
-                let results = cx.background().spawn(task).await;
+                let results = if let Some(repo) = snapshot.repo_for(&abs_path) {
+                    repo.load_head_text(&abs_path).await
+                } else {
+                    None
+                };
 
                 if files_included == settings::GitFilesIncluded::All {
                     results.or_else(|| Some(text.clone()))