Function: magit-read-worktree-directory-offsite
magit-read-worktree-directory-offsite is a byte-compiled function
defined in magit-worktree.el.
Signature
(magit-read-worktree-directory-offsite PROMPT COMMIT)
Documentation
Call read-directory-name in a directory shared by all repositories.
Option magit-read-worktree-offsite-directory specifies that shared
base directory.
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 COMMIT are replaced with dashes. If COMMIT is nil use
just "PREFIX_". Always forward PROMPT as-is.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260822.1158/magit-worktree.el
(defun magit-read-worktree-directory-offsite (prompt commit)
"Call `read-directory-name' in a directory shared by all repositories.
Option `magit-read-worktree-offsite-directory' specifies that shared
base directory.
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 COMMIT are replaced with dashes. If COMMIT is nil use
just \"PREFIX_\". Always forward PROMPT as-is."
(mkdir magit-read-worktree-offsite-directory t)
(read-directory-name
prompt magit-read-worktree-offsite-directory nil nil
(let* ((name (file-name-nondirectory (directory-file-name default-directory)))
(name (if (string-match "_" name)
(substring name 0 (match-beginning 0))
name))
(name (concat name "_")))
(if commit
(concat name (string-replace "/" "-" commit))
(file-name-nondirectory
(make-temp-name
(expand-file-name name magit-read-worktree-offsite-directory)))))))