git-authenticate: 'commit-authorized-keys' properly handles orphan commits.

Previously it would trigger a wrong-number-of-arguments error for
'lset-intersection'.

* guix/git-authenticate.scm (commit-authorized-keys): Add case for when
'commit-parents' returns the empty list.
This commit is contained in:
Ludovic Courtès 2020-06-08 22:25:59 +02:00
parent 72357e2170
commit eef859e853
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -184,8 +184,11 @@ (define (commit-authorizations commit)
default-authorizations)
(throw key error)))))
(apply lset-intersection bytevector=?
(map commit-authorizations (commit-parents commit))))
(match (commit-parents commit)
(() default-authorizations)
(parents
(apply lset-intersection bytevector=?
(map commit-authorizations parents)))))
(define* (authenticate-commit repository commit keyring
#:key (default-authorizations '()))