etc: teams: Add regular expression support to scopes.
authorLiliana Marie Prikler <liliana.prikler@gmail.com>
Fri, 9 Sep 2022 15:27:23 +0000 (17:27 +0200)
committerMathieu Othacehe <othacehe@gnu.org>
Sun, 25 Sep 2022 07:27:59 +0000 (09:27 +0200)
* 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>
etc/teams.scm.in

index 549e31d..a2b22cb 100644 (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)