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))))
(define* (git-repository-url->git-repository-id conn url
#:key (authenticate? #t))
#:key
(create-if-missing? #t)
(authenticate? #t))
(define (->boolean value)
(if value "TRUE" "FALSE"))
@ -245,14 +247,15 @@ SET fetch_with_authentication = "
" WHERE id = " id ";"))
id)
(()
(caar
(exec-query conn
(string-append
"INSERT INTO git_repositories "
"(url, fetch_with_authentication) "
"VALUES "
"('" url "', " (->boolean authenticate?) ") "
"RETURNING id"))))))))
(and create-if-missing?
(caar
(exec-query conn
(string-append
"INSERT INTO git_repositories "
"(url, fetch_with_authentication) "
"VALUES "
"('" url "', " (->boolean authenticate?) ") "
"RETURNING id")))))))))
(define (guix-revisions-and-jobs-for-git-repository conn git-repository-id)
(define query