From bcba1c66822f3801392b5d0220801e8d3856c068 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 31 Jul 2023 23:04:04 -0700 Subject: [PATCH] working_copy: rename `sub_path` to `path` The `sub_path` is created by joining `dir` to a basename. I think calling it just `path` is clear, especially since its the main path involved in each iteration of the loop. --- lib/src/working_copy.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index 8c74f41d3..51b4b4d01 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -672,8 +672,8 @@ impl TreeState { if name == ".jj" || name == ".git" { continue; } - let sub_path = dir.join(&RepoPathComponent::from(name)); - if let Some(file_state) = self.file_states.get(&sub_path) { + let path = dir.join(&RepoPathComponent::from(name)); + if let Some(file_state) = self.file_states.get(&path) { if file_state.file_type == FileType::GitSubmodule { continue; } @@ -682,24 +682,24 @@ impl TreeState { if file_type.is_dir() { // If the whole directory is ignored, skip it unless we're already tracking // some file in it. - if git_ignore.matches_all_files_in(&sub_path.to_internal_dir_string()) - && current_tree.path_value(&sub_path).is_none() + if git_ignore.matches_all_files_in(&path.to_internal_dir_string()) + && current_tree.path_value(&path).is_none() { continue; } work.push(WorkItem { - dir: sub_path, + dir: path, disk_dir: entry.path(), git_ignore: git_ignore.clone(), }); - } else if matcher.matches(&sub_path) { + } else if matcher.matches(&path) { if let Some(progress) = progress { - progress(&sub_path); + progress(&path); } - let maybe_current_file_state = self.file_states.get(&sub_path); + let maybe_current_file_state = self.file_states.get(&path); if maybe_current_file_state.is_none() - && git_ignore.matches_file(&sub_path.to_internal_file_string()) + && git_ignore.matches_file(&path.to_internal_file_string()) { // If it wasn't already tracked and it matches // the ignored paths, then @@ -714,18 +714,18 @@ impl TreeState { err, })?; if let Some(new_file_state) = file_state(&metadata) { - deleted_files.remove(&sub_path); + deleted_files.remove(&path); let update = self.get_updated_tree_value( - &sub_path, + &path, entry.path(), maybe_current_file_state, ¤t_tree, &new_file_state, )?; if let Some(tree_value) = update { - tree_builder.set(sub_path.clone(), tree_value); + tree_builder.set(path.clone(), tree_value); } - self.file_states.insert(sub_path, new_file_state); + self.file_states.insert(path, new_file_state); } } }