coreboot-kgpe-d16/util/scripts
Michael Niewöhner 158fed9ee7 maintainers.go: correct handling of globs
maintainers.go does not handle globs as described in MAINTAINERS.
Instead of only matching the files inside a directory, it also matches
everything below. Also, a glob used in between (`e.g. path/to/*/dir`)
could lead to matching many more paths unexpectedly.

This is caused by the way paths using globs are converted to regegular
expressions for use with gerrit:

1. The script converts all paths with trailing slash to a path with
   trailing glob. That means, a recursive match on a directory gets
   converted to match only the files in the directory (at least
   according to the documentation - if there wasn't 2).

   Example: `path/to/dir/` becomes `path/to/dir/*`

2. When converting the path to a regex, all globs get converted to
   prefix matching by replacing the glob by `.*`. Instead of only
   matching the files in the directory, everything below matches,
   which is a) not what the documentation states and b) the opposite
   of what 1. did first.

   Example: `path/to/dir/*` becomes `^path/to/dir/.*$`

In sum, this leads to all sorts of issues. Examples:
  - `path/*/dir`    becomes `^path/.*/dir$`
  - `path/to/dir/*` becomes `^path/to/dir/.*$`
  - `path/to/*.c`   becomes `^path/to/.*\.c$`

This change fixes that behaviour by:
- dropping the wrong conversion from 1. above.
- fixing glob matching by replacing `*` by `[^/]`.
- handling paths with trailing `/` as prefix, as documented.

The change was not split because these changes depend on each other and
splitting would break recursive matching between the commits.

Tests:
1. diffed output before and after is equal (!= the same)
2. manual testing of glob matching

Change-Id: I4347a60874e4f07e41bdee43cc312547bea99008
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52275
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-04-14 10:50:18 +00:00
..
config
cross-repo-cherrypick util: Update all shebangs to use /usr/bin/env 2021-01-25 08:57:40 +00:00
decode_spd.sh util: Update all shebangs to use /usr/bin/env 2021-01-25 08:57:40 +00:00
description.md util/bincfg: Add DDR4 SPD spec 2020-03-19 10:31:08 +00:00
dts-to-fmd.sh util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
find-unused-kconfig-symbols.sh util: Update all shebangs to use /usr/bin/env 2021-01-25 08:57:40 +00:00
gerrit-rebase util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
get_maintainer.pl util: Add SPDX header, replacing boiler plate where applicable 2020-05-11 17:11:59 +00:00
maintainers.go maintainers.go: correct handling of globs 2021-04-14 10:50:18 +00:00
no-fsf-addresses.sh util: Update all shebangs to use /usr/bin/env 2021-01-25 08:57:40 +00:00
parse-maintainers.pl util: Add SPDX header, replacing boiler plate where applicable 2020-05-11 17:11:59 +00:00
prepare-commit-msg.clang-format
ucode_h_to_bin.sh util: Add SPDX header, replacing boiler plate where applicable 2020-05-11 17:11:59 +00:00
update_submodules treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00