reduce commit/diff queries on construction
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, andNewOperator - It reduces
And()to&Constant{true}andOr()to&Constant{false} - It reduces
And(x)andOr(x)tox - It reduces
And(And(x), y)toAnd(x, y)andOr(x, Or(y))toOr(x, y) - It reduces
Not(Not(x))tox
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.