Handle NULL values for included_branches

This commit is contained in:
Christopher Baines 2025-01-17 12:23:46 +00:00
parent c886685e92
commit 25bf45fe77
3 changed files with 10 additions and 16 deletions

View file

@ -59,12 +59,10 @@
conn conn
git-repository-id))) git-repository-id)))
(let ((excluded-branch? (let ((excluded-branch?
(branch-in-list? excluded-branches branch-name)) (branch-in-list? excluded-branches branch-name)))
(included-branch?
(branch-in-list? included-branches branch-name)))
(when (and (not excluded-branch?) (when (and (not excluded-branch?)
(or (null? included-branches) (or (NULL? included-branches)
included-branch?)) (branch-in-list? included-branches branch-name)))
(if (string=? commit-all-zeros x-git-newrev) (if (string=? commit-all-zeros x-git-newrev)
(insert-git-commit-entry conn (insert-git-commit-entry conn
(or (git-branch-for-repository-and-name (or (git-branch-for-repository-and-name

View file

@ -139,7 +139,7 @@ WHERE id = $1"
item)) item))
lst)) lst))
(match (exec-query (match (exec-query-with-null-handling
conn conn
" "
SELECT included_branches, excluded_branches SELECT included_branches, excluded_branches
@ -147,13 +147,11 @@ FROM git_repositories WHERE id = $1"
(list (number->string id))) (list (number->string id)))
(((included_branches excluded_branches)) (((included_branches excluded_branches))
(values (values
(if (or (eq? #f included_branches) (if (NULL? included_branches)
(string-null? included_branches)) included_branches
'()
(make-regexes (make-regexes
(parse-postgresql-array-string included_branches))) (parse-postgresql-array-string included_branches)))
(if (or (eq? excluded_branches #f) (if (NULL? excluded_branches)
(string-null? excluded_branches))
'() '()
(make-regexes (make-regexes
(parse-postgresql-array-string excluded_branches))))))) (parse-postgresql-array-string excluded_branches)))))))

View file

@ -182,12 +182,10 @@
(filter (filter
(lambda (branch-name) (lambda (branch-name)
(let ((excluded-branch? (let ((excluded-branch?
(branch-in-list? excluded-branches branch-name)) (branch-in-list? excluded-branches branch-name)))
(included-branch?
(branch-in-list? included-branches branch-name)))
(and (not excluded-branch?) (and (not excluded-branch?)
(or (null? included-branches) (or (NULL? included-branches)
included-branch?)))) (branch-in-list? included-branches branch-name)))))
(delete-duplicates! (delete-duplicates!
(append! (append!
(map car repository-branches) (map car repository-branches)