summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-08 22:25:59 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-09 00:34:52 +0200
commiteef859e8538a74f7dd743bf294f9c32a62a52381 (patch)
treea2f5848e1418ebcd19b4b3875cec8504e43ea1f7
parent72357e2170e88f73c11ff089f87a744cee8606ec (diff)
downloadguix-eef859e8538a74f7dd743bf294f9c32a62a52381.tar.gz
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.
-rw-r--r--guix/git-authenticate.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/git-authenticate.scm b/guix/git-authenticate.scm
index 00d22ef479..c333717136 100644
--- a/guix/git-authenticate.scm
+++ b/guix/git-authenticate.scm
@@ -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 '()))