Default to full-file evaluation if diffs are not available

Gerrit's diff cache reads objects using a self-created
ObjectReader without an option to pass in a RevWalk or an
ObjectReader instance.

This works for 'git push' where the commit we want to validate
has already been written to disk, but fails for REST endpoints
where the ObjectInserter has not been flushed yet when the
CommitValidators are called. Hence, the diff cache can't see
the objects it should diff.

There are multiple options to fix this, but no golden way. To
unblock users of the plugin, we default back to full-file
evaluation if diffs aren't available. We'll adapt Gerrit
core to be able to use diffs in the currently broken cases
as well. Options we are eyeballing include:

1) Pass an ObjectInserter/Reader to PatchListCache
2) Make Repository aware of open ObjectInserters
3) Adapt CreateChange to flush twice

Change-Id: Ic9ac19e8913243c7d78e971a300f52dffe983743
2 files changed