Function: doom-modeline--in-git-worktree-p
doom-modeline--in-git-worktree-p is a natively compiled function
defined in doom-modeline-segments.el.
Signature
(doom-modeline--in-git-worktree-p)
Documentation
Return non-nil if the current buffer's file is in a git worktree.
Source Code
;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline-segments.el
(defun doom-modeline--in-git-worktree-p ()
"Return non-nil if the current buffer's file is in a git worktree."
(when-let* ((git-dir (and buffer-file-name
(not (file-remote-p buffer-file-name)) ; avoid tramp hangs
(locate-dominating-file buffer-file-name ".git"))))
;; In a worktree, .git is a file (not a directory)
(file-regular-p (expand-file-name ".git" git-dir))))