Fix MissingObjectException when validating code owner configs in newly created merge

If a revision is newly inserted, but not committed to the repository
yet, it can only be seen from the RevWalk instance that created it, but
not by newly instantiated RevWalks. When a new merge commit is created
via the create change REST endpoint we have exactly this case. The new
merge commit is newly inserted and is only visible from the RevWalk
instance that created it. So far CodeOwnerConfigValidator created new
RevWalk instances to load the revision and those couldn’t see the newly
created merge commit which caused the MissingObjectException. Now
CodeOwnerConfigValidator no longer instantiates new RevWalk instances
but instead passes on the RevWalk instance that we get via
CommitReceivedEvent. This way the newly created merge commit can now be
found and the code owner configs in it can be validated.

The newly added test reproduced the MissingObjectException and ensures
that this is working now.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I7ec82537404b5d1ce9c884146f3759e43ff34cc7
3 files changed
tree: 5d790170282008a897c0829ddf10d7f6515d9025
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md