Almost all callers are just switching between a single policy, e.g. the
default of GERRIT for ChangeInserter/PatchSetInserter, and no
validation. The internals of CommitValidators.Factory#create just called
one of the for* factory methods depending on the enum value; it's just
as readable to do this at the source.
Within ChangeInserter/PatchSetInserter, it's just as easy to represent
do/don't validate with a single boolean value. The interaction with
RebaseChangeOp is slightly nonobvious: it used a null enum field value
to mean don't override PatchSetInserter's default. Thus we need to
explicitly set the default of the boolean value to true. (Or use
tri-state Boolean, but boolean is more consistent with the rest of the
fields in this class.)
It's worth noting that forGerritCommits is always called from within a
BatchUpdateOp, which means we can later change its parameters to not
pass a full Repository instance. By contrast forReceiveCommits is only
called from ReceiveCommits, outside of the BatchUpdate, so it always has
a full Repository available. Splitting the factory methods up in this
way allows us to pass different arguments to the different paths.
Change-Id: I833b739f2c4ab4a65ea80382b1c147dd6adc1892