diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-12 10:11:58 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-12 10:11:58 +0200 |
| commit | 10c366ed52c118383f5f467fdea3e428cc0f867b (patch) | |
| tree | a19a877cdb9a50f805c33f7f36fea290e8f1e1e3 /lisp/magit-git.el | |
| parent | d8b4690900a00bc32e9f4dd0fb71b96614a96b51 (diff) | |
magit-read-branch-or-commit: Support a list for EXCLUDE argument
Diffstat (limited to 'lisp/magit-git.el')
| -rw-r--r-- | lisp/magit-git.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/magit-git.el b/lisp/magit-git.el index aa0282a..9b2b023 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -2635,13 +2635,15 @@ and this option only controls what face is used.") (magit-get-current-branch)))) (defun magit-read-branch-or-commit (prompt &optional secondary-default exclude) - (let ((current (magit-get-current-branch)) - (branch-at-point (magit-branch-at-point)) - (commit-at-point (magit-commit-at-point)) - (choices (delete exclude (magit-list-refnames nil t)))) - (when (equal current exclude) + (let* ((current (magit-get-current-branch)) + (branch-at-point (magit-branch-at-point)) + (commit-at-point (magit-commit-at-point)) + (exclude (ensure-list exclude)) + (choices (cl-set-difference (magit-list-refnames nil t) + exclude :test #'equal))) + (when (member current exclude) (setq current nil)) - (when (equal branch-at-point exclude) + (when (member branch-at-point exclude) (setq branch-at-point nil)) (when (and commit-at-point (not branch-at-point)) (setq choices (cons commit-at-point choices))) |
