working_copy: don't look up file state twice while visiting directories

This commit is contained in:
Yuya Nishihara 2023-11-28 10:51:03 +09:00
parent bb72def464
commit c9150d02fc

View file

@ -781,7 +781,8 @@ impl TreeState {
return Ok(()); return Ok(());
} }
let path = dir.join(RepoPathComponent::new(name)); 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 { if file_state.file_type == FileType::GitSubmodule {
return Ok(()); return Ok(());
} }
@ -856,7 +857,6 @@ impl TreeState {
if let Some(progress) = progress { if let Some(progress) = progress {
progress(&path); progress(&path);
} }
let maybe_current_file_state = file_states.get(&path);
if maybe_current_file_state.is_none() if maybe_current_file_state.is_none()
&& git_ignore.matches(path.as_internal_file_string()) && git_ignore.matches(path.as_internal_file_string())
{ {