Function: vc-git-dir--branch-headers
vc-git-dir--branch-headers is a byte-compiled function defined in
vc-git.el.gz.
Signature
(vc-git-dir--branch-headers)
Documentation
Return headers for branch-related information.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-dir--branch-headers ()
"Return headers for branch-related information."
(let ((branch (vc-git--current-branch))
tracking remote-url)
(if branch
(when-let* ((branch-merge
(vc-git--out-match
`("config" ,(concat "branch." branch ".merge"))
"^\\(refs/heads/\\)?\\(.+\\)$" 2))
(branch-remote
(vc-git--out-match
`("config" ,(concat "branch." branch ".remote"))
"\\([^\n]+\\)" 1)))
(if (string= branch-remote ".")
(setq tracking branch-merge
remote-url "none (tracking local branch)")
(setq tracking (concat branch-remote "/" branch-merge)
remote-url (vc-git-repository-url
default-directory branch-remote))))
(setq branch "none (detached HEAD)"))
(cl-flet ((fmt (key value)
(concat
(propertize (format "% -11s: " key) 'face 'vc-dir-header)
(propertize value 'face 'vc-dir-header-value))))
(remove nil (list
(fmt "Branch" branch)
(and tracking (fmt "Tracking" tracking))
(and remote-url (fmt "Remote" remote-url)))))))