From b72f04ba61985c74356f8e6c326957c871ac07b3 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 29 Oct 2023 07:03:15 -0700 Subject: [PATCH] merged_tree: rename `all_tree_conflict_names()` since it's not about conflicts --- lib/src/merged_tree.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/src/merged_tree.rs b/lib/src/merged_tree.rs index b8708a970..f86cd2986 100644 --- a/lib/src/merged_tree.rs +++ b/lib/src/merged_tree.rs @@ -170,7 +170,7 @@ impl MergedTree { pub fn names<'a>(&'a self) -> Box + 'a> { match self { MergedTree::Legacy(tree) => Box::new(tree.data().names()), - MergedTree::Merge(conflict) => Box::new(all_tree_conflict_names(conflict)), + MergedTree::Merge(conflict) => Box::new(all_tree_basenames(conflict)), } } @@ -434,7 +434,7 @@ pub type TreeDiffStream<'matcher> = Pin< >, >; -fn all_tree_conflict_names(trees: &Merge) -> impl Iterator { +fn all_tree_basenames(trees: &Merge) -> impl Iterator { trees .iter() .map(|tree| tree.data().names()) @@ -455,7 +455,7 @@ fn merge_trees(merge: &Merge) -> Result, TreeMergeError> { // any conflicts. let mut new_tree = backend::Tree::default(); let mut conflicts = vec![]; - for basename in all_tree_conflict_names(merge) { + for basename in all_tree_basenames(merge) { let path_merge = merge.map(|tree| tree.value(basename).cloned()); let path = dir.join(basename); let path_merge = merge_tree_values(store, &path, path_merge)?; @@ -638,7 +638,7 @@ impl<'a> ConflictEntriesNonRecursiveIterator<'a> { if trees.is_resolved() { Box::new(iter::empty()) } else { - Box::new(all_tree_conflict_names(trees)) + Box::new(all_tree_basenames(trees)) } } }; @@ -774,15 +774,14 @@ impl<'a> TreeEntryDiffIterator<'a> { merge_iters(before.data().names(), after.data().names()) } (MergedTree::Merge(before), MergedTree::Legacy(after)) => { - merge_iters(all_tree_conflict_names(before), after.data().names()) + merge_iters(all_tree_basenames(before), after.data().names()) } (MergedTree::Legacy(before), MergedTree::Merge(after)) => { - merge_iters(before.data().names(), all_tree_conflict_names(after)) + merge_iters(before.data().names(), all_tree_basenames(after)) + } + (MergedTree::Merge(before), MergedTree::Merge(after)) => { + merge_iters(all_tree_basenames(before), all_tree_basenames(after)) } - (MergedTree::Merge(before), MergedTree::Merge(after)) => merge_iters( - all_tree_conflict_names(before), - all_tree_conflict_names(after), - ), }; TreeEntryDiffIterator { before,