Skip to content

Commit dd07045

Browse files
Refactor and annotate functions in history handling (#1304)
1 parent 5e414ce commit dd07045

File tree

2 files changed

+131
-71
lines changed

2 files changed

+131
-71
lines changed

josh-core/src/filter/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,12 +833,18 @@ pub fn unapply<'a>(
833833
}
834834

835835
if let Op::Chain(a, b) = to_op(filter) {
836-
let i = if let Ok(i) = invert(a) { invert(i)? } else { a };
837-
let p = apply(transaction, i, parent_tree.clone())?;
836+
// If filter "a" is invertable, use "invert(invert(a))" version of it, otherwise use as is
837+
let a_normalized = if let Ok(a_inverted) = invert(a) {
838+
invert(a_inverted)?
839+
} else {
840+
a
841+
};
842+
let filtered_parent_tree = apply(transaction, a_normalized, parent_tree.clone())?;
843+
838844
return unapply(
839845
transaction,
840846
a,
841-
unapply(transaction, b, tree, p)?,
847+
unapply(transaction, b, tree, filtered_parent_tree)?,
842848
parent_tree,
843849
);
844850
}

0 commit comments

Comments
 (0)