commit | a03d233df10a418dc162cbdc4e5b09e704996377 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Tue Mar 16 15:55:41 2021 +0100 |
committer | Edwin Kempin <ekempin@google.com> | Wed Mar 17 13:56:44 2021 +0100 |
tree | 433046fdd122646a67a6a3ea23d9a7b5589b2d62 | |
parent | 1d1757274ab465ac79553ced94fb82a55fbaf9cf [diff] |
CodeOwnerApprovalCheck: Skip the file path when looking up OWNERS files When checking code owner approvals we iterate over all files that are touched in the change and lookup the OWNERS files that are relevant for them. For each file we start at the file path and then iterate up the parent folders to look for OWNERS files. E.g. for file "/foo/bar/baz.md" we check the following OWNERS files: 1. /foo/bar/baz.md/OWNERS 2. /foo/bar/OWNERS 3. /foo/OWNERS 4. /OWNERS If we know that the given path is a file path, as in CodeOwnerApprovalCheck, we can skip the first lookup as we know that this OWNERS file will never exist. The lower layers (CodeOwnerConfigHierarchy) accept arbitrary paths (file paths and folder paths). Hence they must continue to check for the "<path>/OWNERS" file. Skipping this lookup in CodeOwnersApprovalCheck may look like an optimization that is not worth doing, but we saw such lookups of non-existing OWNERS files take up to 10ms, which sums up if you have changes that touch 1000s of files. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I9be58eb55183ef9177ae0c12b85691b5a26a7abd
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.