diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm index f6cceb1..8fcbb43 100644 --- a/guix-data-service/model/git-repository.scm +++ b/guix-data-service/model/git-repository.scm @@ -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