branch: elpa/magit
commit 10c366ed52c118383f5f467fdea3e428cc0f867b
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-read-branch-or-commit: Support a list for EXCLUDE argument
---
lisp/magit-git.el | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index aa0282a834b..9b2b02389aa 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)))