From c9150d02fc1d0637a7ad5c299dec8c316512427b Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 28 Nov 2023 10:51:03 +0900 Subject: [PATCH] working_copy: don't look up file state twice while visiting directories --- lib/src/local_working_copy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/local_working_copy.rs b/lib/src/local_working_copy.rs index 66f6a845b..eb3d5a3fa 100644 --- a/lib/src/local_working_copy.rs +++ b/lib/src/local_working_copy.rs @@ -781,7 +781,8 @@ impl TreeState { return Ok(()); } let path = dir.join(RepoPathComponent::new(name)); - if let Some(file_state) = file_states.get(&path) { + let maybe_current_file_state = file_states.get(&path); + if let Some(file_state) = maybe_current_file_state { if file_state.file_type == FileType::GitSubmodule { return Ok(()); } @@ -856,7 +857,6 @@ impl TreeState { if let Some(progress) = progress { progress(&path); } - let maybe_current_file_state = file_states.get(&path); if maybe_current_file_state.is_none() && git_ignore.matches(path.as_internal_file_string()) {