]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter.c: parameterize match functions over patterns
authorJeff King <peff@peff.net>
Mon, 10 Jul 2023 21:12:16 +0000 (17:12 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2023 21:48:55 +0000 (14:48 -0700)
commit284c55deb53921457929ca2afe231c48e6cada85
tree994fb483d381281dd85b539b1864b6f19b6604a6
parentb571fb98008b485bfc6f7d6538b79a7e92d731f4
ref-filter.c: parameterize match functions over patterns

`match_pattern()` and `match_name_as_path()` both take a `struct
ref_filter *`, and then store a stack variable `patterns` pointing at
`filter->patterns`.

The subsequent patch will add a new array of patterns to match over (the
excluded patterns, via a new `git for-each-ref --exclude` option),
treating the return value of these functions differently depending on
which patterns are being used to match.

Tweak `match_pattern()` and `match_name_as_path()` to take an array of
patterns to prepare for passing either in.

Once we start passing either in, `match_pattern()` will have little to
do with a particular `struct ref_filter *` instance. To clarify this,
drop it from the argument list, and replace it with the only bit of the
`ref_filter` that we care about (`filter->ignore_case`).

Co-authored-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c