aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/magit-commit.el10
-rw-r--r--lisp/magit-tag.el2
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 365e3a3..028c3bf 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -144,7 +144,7 @@ Also see `git-commit-post-finish-hook'."
:shortarg "-S"
:argument "--gpg-sign="
:allow-empty t
- :reader 'magit-read-gpg-secret-key)
+ :reader 'magit-read-gpg-signing-key)
(defvar magit-gpg-secret-key-hist nil)
@@ -176,6 +176,14 @@ Also see `git-commit-post-finish-hook'."
(set-text-properties 0 (length choice) nil choice)
choice))
+(defun magit-read-gpg-signing-key (prompt &optional initial-input history)
+ (magit-read-gpg-secret-key
+ prompt initial-input history
+ (lambda (cert)
+ (cl-some (lambda (key)
+ (memq 'sign (epg-sub-key-capability key)))
+ (epg-key-sub-key-list cert)))))
+
(transient-define-argument magit-commit:--reuse-message ()
:description "Reuse commit message"
:class 'transient-option
diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el
index dbec939..1363d85 100644
--- a/lisp/magit-tag.el
+++ b/lisp/magit-tag.el
@@ -56,7 +56,7 @@
:class 'transient-option
:shortarg "-u"
:argument "--local-user="
- :reader 'magit-read-gpg-secret-key
+ :reader 'magit-read-gpg-signing-key
:history-key 'magit:--gpg-sign)
;;;###autoload