Function: magit--insert-worktree

magit--insert-worktree is a byte-compiled function defined in magit-worktree.el.

Signature

(magit--insert-worktree CONFIG HEAD)

Documentation

Insert worktree section for CONFIG.

See magit-list-worktrees for the format of CONFIG. HEAD is a prettified reference or revision representing the worktree, with padding for alignment.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-worktree.el
(defun magit--insert-worktree (config head)
  "Insert worktree section for CONFIG.
See `magit-list-worktrees' for the format of CONFIG.  HEAD is
a prettified reference or revision representing the worktree,
with padding for alignment."
  ;; #4926 Before changing the signature, inform @vermiculus.
  (let ((path (car config)))
    (magit-insert-section (worktree path)
      (insert head)
      (insert (let ((relative (file-relative-name path))
                    (absolute (abbreviate-file-name path)))
                (if (or (> (string-width relative) (string-width absolute))
                        (equal relative "./"))
                    absolute
                  relative)))
      (insert ?\n))))