Function: projectile--parse-git-worktree-list
projectile--parse-git-worktree-list is a byte-compiled function
defined in projectile.el.
Signature
(projectile--parse-git-worktree-list OUTPUT)
Documentation
Parse the git worktree list --porcelain OUTPUT into worktree plists.
Records are separated by blank lines and each opens with a worktree
line. Bare repositories are skipped: they have no working tree, so
there's nothing there to switch to.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--parse-git-worktree-list (output)
"Parse the `git worktree list --porcelain' OUTPUT into worktree plists.
Records are separated by blank lines and each opens with a `worktree'
line. Bare repositories are skipped: they have no working tree, so
there\\='s nothing there to switch to."
(delq nil
(mapcar
(lambda (record)
(let ((lines (split-string record "\n" t)))
(unless (member "bare" lines)
(let ((worktree (list :path (file-name-as-directory
(string-remove-prefix
"worktree " (car lines))))))
;; `HEAD' and `detached' say nothing a switch needs, and
;; `locked' doesn't stop one, so they're all skipped here.
(dolist (line (cdr lines) worktree)
(cond
((string-prefix-p "branch " line)
(plist-put worktree :label
(string-remove-prefix
"refs/heads/"
(string-remove-prefix "branch " line))))
((string-prefix-p "prunable" line)
(plist-put worktree :prunable t))))))))
(split-string output "\n\n" t))))