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

    magit-worktree-checkout: Do not offer checked out branches
    
    The same branch cannot be checked out in multiple worktrees.
---
 lisp/magit-worktree.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el
index 476299f6682..35a7f5bcdec 100644
--- a/lisp/magit-worktree.el
+++ b/lisp/magit-worktree.el
@@ -57,7 +57,9 @@ Used by `magit-worktree-checkout' and 
`magit-worktree-branch'."
 (defun magit-worktree-checkout (directory branch)
   "Checkout BRANCH in a new worktree at DIRECTORY."
   (interactive
-   (let ((branch (magit-read-branch-or-commit "In new worktree; checkout")))
+   (let ((branch (magit-read-branch-or-commit
+                  "In new worktree; checkout" nil
+                  (mapcar #'caddr (magit-list-worktrees)))))
      (list (funcall magit-worktree-read-directory-name-function
                     (format "Checkout %s in new worktree: " branch))
            branch)))

Reply via email to