Function: magit-insert-head-branch-header

magit-insert-head-branch-header is a byte-compiled function defined in magit-status.el.

Signature

(magit-insert-head-branch-header &optional BRANCH)

Documentation

Insert a header line about the current branch.

If HEAD is detached, then insert information about that commit instead. The optional BRANCH argument is for internal use only.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-status.el
;;;; Reference Headers

(defun magit-insert-head-branch-header (&optional branch)
  "Insert a header line about the current branch.
If `HEAD' is detached, then insert information about that commit
instead.  The optional BRANCH argument is for internal use only."
  (let ((output (magit-rev-format "%h %s" (or branch "HEAD"))))
    (string-match "^\\([^ ]+\\) \\(.*\\)" output)
    (magit-bind-match-strings (commit summary) output
      (when (equal summary "")
        (setq summary "(no commit message)"))
      (if-let ((branch (or branch (magit-get-current-branch))))
          (magit-insert-section (branch branch)
            (insert (format "%-10s" "Head: "))
            (when magit-status-show-hashes-in-headers
              (insert (propertize commit 'font-lock-face 'magit-hash) ?\s))
            (insert (propertize branch 'font-lock-face 'magit-branch-local))
            (insert ?\s)
            (insert (magit-log--wash-summary summary))
            (insert ?\n))
        (magit-insert-section (commit commit)
          (insert (format "%-10s" "Head: "))
          (insert (propertize commit 'font-lock-face 'magit-hash))
          (insert ?\s)
          (insert (magit-log--wash-summary summary))
          (insert ?\n))))))