aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-07-12 10:12:02 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-07-12 10:12:02 +0200
commitf85f0096aca0ded7bf27ccb7b1fcc0ed67e2a7c5 (patch)
treedccfa527cb5f7485a6adb27e8b30ac98f14733a5
parent9ab5b29a1c8c73492336f536e4ca0915a7af1aa0 (diff)
magit-worktree-checkout: Do not offer checked out branches
The same branch cannot be checked out in multiple worktrees.
-rw-r--r--lisp/magit-worktree.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el
index 476299f..35a7f5b 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)))