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 BRANCH)

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 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-offsite (prompt branch)
  "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 BRANCH are replaced with dashes.  If BRANCH 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 branch
         (concat name (string-replace "/" "-" branch))
       (file-name-nondirectory
        (make-temp-name
         (expand-file-name name magit-read-worktree-offsite-directory)))))))