From 9427bb7553ea5eb7bd51cdc6a94ab570300f624e Mon Sep 17 00:00:00 2001 From: Julia Date: Mon, 3 Oct 2022 11:58:48 -0400 Subject: [PATCH] Be clearer about using GitFilesIncluded setting --- crates/project/src/worktree.rs | 39 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 40efeee1d1586f40ee18bd85dda50029596c74fe..c650111207ed7634771c0c314bc766df5d9ff842 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -673,28 +673,27 @@ impl LocalWorktree { cx.spawn(|this, mut cx| async move { let text = fs.load(&abs_path).await?; - let head_text = if matches!( - files_included, - settings::GitFilesIncluded::All | settings::GitFilesIncluded::OnlyTracked - ) { - let results = if let Some(repo) = snapshot.repo_for(&abs_path) { - cx.background() - .spawn({ - let path = path.clone(); - async move { repo.repo.lock().load_head_text(&path) } - }) - .await - } else { - None - }; + let head_text = match files_included { + settings::GitFilesIncluded::All | settings::GitFilesIncluded::OnlyTracked => { + let results = if let Some(repo) = snapshot.repo_for(&abs_path) { + cx.background() + .spawn({ + let path = path.clone(); + async move { repo.repo.lock().load_head_text(&path) } + }) + .await + } else { + None + }; - if files_included == settings::GitFilesIncluded::All { - results.or_else(|| Some(text.clone())) - } else { - results + if files_included == settings::GitFilesIncluded::All { + results.or_else(|| Some(text.clone())) + } else { + results + } } - } else { - None + + settings::GitFilesIncluded::None => None, }; // Eagerly populate the snapshot with an updated entry for the loaded file