branch: elpa/magit
commit b0021f636040318f3d4a0b0f7691aa5b072de279
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-read-branch-or-commit: Add EXCLUDE argument
---
 lisp/magit-git.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 9973e0848f..1cfc274d63 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2620,13 +2620,16 @@ and this option only controls what face is used.")
                              secondary-default
                              (magit-get-current-branch))))
 
-(defun magit-read-branch-or-commit (prompt &optional secondary-default)
-  (let ((minibuffer-default-add-function (magit--minibuf-default-add-commit)))
-    (or (magit-completing-read prompt (magit-list-refnames nil t)
+(defun magit-read-branch-or-commit (prompt &optional secondary-default exclude)
+  (let ((current (magit-get-current-branch))
+        (atpoint (magit-branch-or-commit-at-point))
+        (minibuffer-default-add-function (magit--minibuf-default-add-commit)))
+    (or (magit-completing-read prompt
+                               (delete exclude (magit-list-refnames nil t))
                                nil nil nil 'magit-revision-history
-                               (or (magit-branch-or-commit-at-point)
+                               (or (and (not (equal atpoint exclude)) atpoint)
                                    secondary-default
-                                   (magit-get-current-branch)))
+                                   (and (not (equal current exclude)) 
current)))
         (user-error "Nothing selected"))))
 
 (defun magit-read-range-or-commit (prompt &optional secondary-default)

Reply via email to