Function: projectile--git-head-branch
projectile--git-head-branch is a byte-compiled function defined in
projectile.el.
Signature
(projectile--git-head-branch GIT-DIR)
Documentation
Return the branch checked out in GIT-DIR, or nil when HEAD is detached.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--git-head-branch (git-dir)
"Return the branch checked out in GIT-DIR, or nil when HEAD is detached."
(let ((head (expand-file-name "HEAD" git-dir)))
(when (file-readable-p head)
(with-temp-buffer
(insert-file-contents head)
(goto-char (point-min))
(when (looking-at "ref:[ \t]*refs/heads/\\(.+?\\)[ \t]*$")
(match-string 1))))))