Add #:create-if-missing? to ‘git-repository-url->git-repository-id’.

This commit is contained in:
Ludovic Courtès 2025-05-27 11:43:45 +02:00
parent 30b2d91bfb
commit 8e7da32f55

View file

@ -226,7 +226,9 @@ FROM git_repositories WHERE id = $1"
(string->number id)))) (string->number id))))
(define* (git-repository-url->git-repository-id conn url (define* (git-repository-url->git-repository-id conn url
#:key (authenticate? #t)) #:key
(create-if-missing? #t)
(authenticate? #t))
(define (->boolean value) (define (->boolean value)
(if value "TRUE" "FALSE")) (if value "TRUE" "FALSE"))
@ -245,6 +247,7 @@ SET fetch_with_authentication = "
" WHERE id = " id ";")) " WHERE id = " id ";"))
id) id)
(() (()
(and create-if-missing?
(caar (caar
(exec-query conn (exec-query conn
(string-append (string-append
@ -252,7 +255,7 @@ SET fetch_with_authentication = "
"(url, fetch_with_authentication) " "(url, fetch_with_authentication) "
"VALUES " "VALUES "
"('" url "', " (->boolean authenticate?) ") " "('" url "', " (->boolean authenticate?) ") "
"RETURNING id")))))))) "RETURNING id")))))))))
(define (guix-revisions-and-jobs-for-git-repository conn git-repository-id) (define (guix-revisions-and-jobs-for-git-repository conn git-repository-id)
(define query (define query