~ruther/guix-local

eef859e8538a74f7dd743bf294f9c32a62a52381 — Ludovic Courtès 6 years ago 72357e2
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.
1 files changed, 5 insertions(+), 2 deletions(-)

M guix/git-authenticate.scm
M guix/git-authenticate.scm => guix/git-authenticate.scm +5 -2
@@ 184,8 184,11 @@ to remove '.guix-authorizations' file")
              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 '()))