FindOwnersBackend: Fix incompatibility of handling globs

The find-owners backend promises to be compatible with the syntax of the
find-owners plugin, but currently the handling of '*' in globs differs.

The find-owners backend in the code-owners plugin currently handles '*'s
in globs like this:

* '*': matches any string that does not include slashes
* '**': matches any string, including slashes

This matches with how globs work in Java [1], however it is incompatible
with the find-owners plugin that handles '*'s in globs like this:

* '*'/'**': matches any string, including slashes

Change the find-owners backend in the code-owners plugin to be
compatible with the find-owners plugin. For this we simply replace any
single '*' character that appears in globs with '**' before we check if
the glob matches.

[1] https://mincong.io/2019/04/16/glob-expression-understanding/

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I1ddc8bf326bbcb8867ffd09eebc7a6739ad7d827
9 files changed
tree: 4edccdb783b623806fd2d3dff445422f7a47ccad
  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