From fd52efa0baaac5c5f76100b25d8543e6bf22f0f3 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 11 Aug 2024 13:18:56 +0900 Subject: [PATCH] merged_tree: leverage Merge entries iterator in all_tree_entries() --- lib/src/merged_tree.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/merged_tree.rs b/lib/src/merged_tree.rs index e47ea3b071..5277db0a23 100644 --- a/lib/src/merged_tree.rs +++ b/lib/src/merged_tree.rs @@ -378,8 +378,13 @@ fn all_tree_entries( .map(|entry| (entry.name(), MergedTreeVal::Resolved(Some(entry.value())))); Either::Left(iter) } else { - // TODO: reimplement as entries iterator? - let iter = all_tree_basenames(trees).map(|name| (name, trees_value(trees, name))); + let iter = all_merged_tree_entries(trees).map(|(name, values)| { + let value = match values.resolve_trivial() { + Some(resolved) => MergedTreeVal::Resolved(*resolved), + None => MergedTreeVal::Conflict(values.map(|value| value.cloned())), + }; + (name, value) + }); Either::Right(iter) } }