diff --git a/config-min.org b/config-min.org index 4c1d274..1deee1f 100644 --- a/config-min.org +++ b/config-min.org @@ -543,6 +543,32 @@ (transient-append-suffix 'magit-worktree "c" '("C" "[async] branch and worktree" my/magit-worktree-branch)) + (defvar my/magit-authors (make-hash-table :test 'equal)) + + (defun my/magit-invalidate-authors () + (interactive) + (remhash (magit-gitdir) my/magit-authors)) + + (defun my/magit-get-authors () + (or (gethash (magit-gitdir) my/magit-authors) + (puthash (magit-gitdir) + (mapcar (lambda (line) + (save-excursion + (and (string-match "\\`[\s\t]+[0-9]+\t" line) + (list (substring line (match-end 0)))))) + (magit-git-lines "shortlog" "-n" "-s" "-e" "HEAD")) + my/magit-authors))) + + (defun my/magit-transient-read-person (prompt initial-input history) + (magit-completing-read + prompt + (my/magit-get-authors) + nil nil initial-input history)) + + (advice-add #'magit-transient-read-person + :override + #'my/magit-transient-read-person) + ;; This is fixed in 5478d4e of magit/transient (committed ) ;; (require 'transient-bug) ;; (with-eval-after-load 'vertico-multiform