etc: teams: Add regular expression support to scopes.

* etc/teams.scm (find-teams-by-scope): Differentiate between raw strings
and regexps.  Make raw string matches strict.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
Liliana Marie Prikler 2022-09-09 17:27:23 +02:00 committed by Mathieu Othacehe
parent 2a66304535
commit b1a7a5723b
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 6 additions and 3 deletions

View File

@ -32,6 +32,7 @@
(srfi srfi-9)
(srfi srfi-26)
(ice-9 format)
(ice-9 regex)
(ice-9 match)
(guix ui)
(git))
@ -289,9 +290,11 @@ of file names as string."
(hash-fold
(lambda (key team acc)
(if (any (lambda (file)
(any (lambda (scope)
;; XXX: Add regex support?
(string-prefix? scope file))
(any (match-lambda
((? string? scope)
(string=? scope file))
((? regexp? scope)
(regexp-exec scope file)))
(team-scope team)))
files)
(cons team acc)