Skip to content

Commit

Permalink
merged_tree: leverage Merge<Tree> entries iterator in all_tree_entries()
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Aug 12, 2024
1 parent 88018e8 commit fd52efa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/merged_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit fd52efa

Please sign in to comment.