Variable: projectile-worktree-functions
projectile-worktree-functions is a customizable variable defined in
projectile.el.
Value
(projectile-worktrees-from-git
projectile-worktrees-from-jj
projectile-worktrees-from-known-projects)
Documentation
Functions consulted by projectile-project-worktrees.
Each is called with a project root and should return a list of plists,
one per checkout of that project's repository, with the keys :path
(the checkout's directory, mandatory), :label (what tells this
checkout apart from the others - a branch, a workspace name - if that's
known) and :prunable (non-nil when the checkout is registered but no
longer on disk). Results from all the functions are
merged and de-duplicated by path, so a checkout found twice is listed
once, and a function that has nothing to say should return nil.
The default set covers git worktrees and Jujutsu workspaces, both of
which the version control system enumerates itself, and anything else via
the known projects (see projectile-worktrees-from-known-projects).
This variable was added, or its default value changed, in projectile version 3.4.0.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;; Worktrees
;;
;; A worktree, in the sense this section means it, is another directory
;; holding the same repository: a real `git worktree', or simply a second
;; clone, which is how the same workflow gets done without the plumbing.
;; `projectile-switch-worktree' offers both, because from where the user
;; sits they're the same thing - the other place this project is checked
;; out, on another branch.
;;
;; Worktrees are found by `projectile-worktree-functions', which is a list
;; so that a version control system Projectile can enumerate directly
;; doesn't have to go through the generic fallback. Each entry takes a
;; project root and returns a list of plists with `:path' (mandatory),
;; `:label' and `:prunable'.
(defcustom projectile-worktree-functions
'(projectile-worktrees-from-git
projectile-worktrees-from-jj
projectile-worktrees-from-known-projects)
"Functions consulted by `projectile-project-worktrees'.
Each is called with a project root and should return a list of plists,
one per checkout of that project\\='s repository, with the keys `:path'
(the checkout\\='s directory, mandatory), `:label' (what tells this
checkout apart from the others - a branch, a workspace name - if that\\='s
known) and `:prunable' (non-nil when the checkout is registered but no
longer on disk). Results from all the functions are
merged and de-duplicated by path, so a checkout found twice is listed
once, and a function that has nothing to say should return nil.
The default set covers git worktrees and Jujutsu workspaces, both of
which the version control system enumerates itself, and anything else via
the known projects (see `projectile-worktrees-from-known-projects')."
:group 'projectile
:type '(repeat function)
:package-version '(projectile . "3.4.0"))