Function: magit-read-worktree-directory-offsite
magit-read-worktree-directory-offsite is a natively 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 /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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)))))))