Fix MissingObjectException when validating OWNERS imports on create change

When a new merge change is created through the Create Change REST
endpoint the code owner config validator can see the newly created merge
commit only through the provided RevWalk. Using another (new) RevWalk
instance does not see this revision yet and trying to access it fails
with a MissingObjectException. For validating imports of code owner
configs we always created a new RevWalk to check if the imported code
owner config exists. If a code owner config was imported from the same
project, and thus from the newly created merge commit, it failed with
a MissingObjectException. Fix this by using the provided RevWalk
instance in this case. The RevWalk instance is specific to the repo for
which it was created, hence for loading code owner configs from other
projects, we still need to create a new RevWalk instance (which happens
when we call CodeOwnerBackend#getCodeOwnerConfig(CodeOwnerConfig.Key,
ObjectId)).

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Icd74c3393e1b4e5fd00a495d290109ede74649a7
3 files changed
tree: 48ccb40d5a640f3319a5b70a0681eb518552769c
  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