Skip to content

reduce commit/diff queries on construction

Warren Gifford requested to merge cc/reduce-on-construction into main

Created by: camdencheek

This commit takes a stab at reducing commit/diff query trees during construction.

In response to Rijnard's comment

  • It adds NewAnd, NewOr, NewNot, and NewOperator
  • It reduces And() to &Constant{true} and Or() to &Constant{false}
  • It reduces And(x) and Or(x) to x
  • It reduces And(And(x), y) to And(x, y) and Or(x, Or(y)) to Or(x, y)
  • It reduces Not(Not(x)) to x

This does some basic minimization during query construction to keep from generating deeply nested trees, but does not do any additional optimization passes. Those will be coming in a followup PR as a separate step.

Merge request reports

Loading