Function: magit-read-worktree-directory-sibling
magit-read-worktree-directory-sibling is a byte-compiled function
defined in magit-worktree.el.
Signature
(magit-read-worktree-directory-sibling PROMPT BRANCH)
Documentation
Call read-directory-name in parent directory of current worktree.
For read-directory-names INITIAL argument use a string based on the
name of the current worktree and BRANCH. Use "PREFIX_BRANCH" where
PREFIX is the name of the current worktree, up to the first underscore,
and slashes in BRANCH are replaced with dashes. If BRANCH is nil use
just "PREFIX_". Always forward PROMPT as-is.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-worktree.el
(defun magit-read-worktree-directory-sibling (prompt branch)
"Call `read-directory-name' in parent directory of current worktree.
For `read-directory-name's INITIAL argument use a string based on the
name of the current worktree and BRANCH. Use \"PREFIX_BRANCH\" where
PREFIX is the name of the current worktree, up to the first underscore,
and slashes in BRANCH are replaced with dashes. If BRANCH is nil use
just \"PREFIX_\". Always forward PROMPT as-is."
(let* ((path (directory-file-name default-directory))
(name (file-name-nondirectory path)))
(read-directory-name
prompt (file-name-directory path) nil nil
(concat (if (string-match "_" name)
(substring name 0 (match-beginning 0))
name)
"_"
(and branch (string-replace "/" "-" branch))))))