aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-01-17 12:23:46 +0000
committerChristopher Baines <mail@cbaines.net>2025-01-17 12:23:46 +0000
commit25bf45fe7734ea8de4e98c97595420b19c871e61 (patch)
tree6f00dfe51d03f5b8fc3ccc2e59150ba8d9e227d3
parentc886685e9284da4bbed9377f70dd70da9e7ca29f (diff)
downloaddata-service-25bf45fe7734ea8de4e98c97595420b19c871e61.tar
data-service-25bf45fe7734ea8de4e98c97595420b19c871e61.tar.gz
Handle NULL values for included_branches
-rw-r--r--guix-data-service/branch-updated-emails.scm8
-rw-r--r--guix-data-service/model/git-repository.scm10
-rw-r--r--guix-data-service/poll-git-repository.scm8
3 files changed, 10 insertions, 16 deletions
diff --git a/guix-data-service/branch-updated-emails.scm b/guix-data-service/branch-updated-emails.scm
index aeb1570..2c0e992 100644
--- a/guix-data-service/branch-updated-emails.scm
+++ b/guix-data-service/branch-updated-emails.scm
@@ -59,12 +59,10 @@
conn
git-repository-id)))
(let ((excluded-branch?
- (branch-in-list? excluded-branches branch-name))
- (included-branch?
- (branch-in-list? included-branches branch-name)))
+ (branch-in-list? excluded-branches branch-name)))
(when (and (not excluded-branch?)
- (or (null? included-branches)
- included-branch?))
+ (or (NULL? included-branches)
+ (branch-in-list? included-branches branch-name)))
(if (string=? commit-all-zeros x-git-newrev)
(insert-git-commit-entry conn
(or (git-branch-for-repository-and-name
diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm
index c05376f..b5f9fbe 100644
--- a/guix-data-service/model/git-repository.scm
+++ b/guix-data-service/model/git-repository.scm
@@ -139,7 +139,7 @@ WHERE id = $1"
item))
lst))
- (match (exec-query
+ (match (exec-query-with-null-handling
conn
"
SELECT included_branches, excluded_branches
@@ -147,13 +147,11 @@ FROM git_repositories WHERE id = $1"
(list (number->string id)))
(((included_branches excluded_branches))
(values
- (if (or (eq? #f included_branches)
- (string-null? included_branches))
- '()
+ (if (NULL? included_branches)
+ included_branches
(make-regexes
(parse-postgresql-array-string included_branches)))
- (if (or (eq? excluded_branches #f)
- (string-null? excluded_branches))
+ (if (NULL? excluded_branches)
'()
(make-regexes
(parse-postgresql-array-string excluded_branches)))))))
diff --git a/guix-data-service/poll-git-repository.scm b/guix-data-service/poll-git-repository.scm
index 8dfd13d..bff0de0 100644
--- a/guix-data-service/poll-git-repository.scm
+++ b/guix-data-service/poll-git-repository.scm
@@ -182,12 +182,10 @@
(filter
(lambda (branch-name)
(let ((excluded-branch?
- (branch-in-list? excluded-branches branch-name))
- (included-branch?
- (branch-in-list? included-branches branch-name)))
+ (branch-in-list? excluded-branches branch-name)))
(and (not excluded-branch?)
- (or (null? included-branches)
- included-branch?))))
+ (or (NULL? included-branches)
+ (branch-in-list? included-branches branch-name)))))
(delete-duplicates!
(append!
(map car repository-branches)