Function: magit-insert-upstream-branch-header
magit-insert-upstream-branch-header is a byte-compiled function
defined in magit-status.el.
Signature
(magit-insert-upstream-branch-header &optional BRANCH UPSTREAM KEYWORD)
Documentation
Insert a header line about the upstream of the current branch.
If no branch is checked out, then insert nothing. The optional arguments are for internal use only.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-status.el
(defun magit-insert-upstream-branch-header (&optional branch upstream keyword)
"Insert a header line about the upstream of the current branch.
If no branch is checked out, then insert nothing. The optional
arguments are for internal use only."
(when-let ((branch (or branch (magit-get-current-branch))))
(let ((remote (magit-get "branch" branch "remote"))
(merge (magit-get "branch" branch "merge"))
(rebase (magit-get "branch" branch "rebase")))
(when (or remote merge)
(unless upstream
(setq upstream (magit-get-upstream-branch branch)))
(magit-insert-section (branch upstream)
(pcase rebase
("true")
("false" (setq rebase nil))
(_ (setq rebase (magit-get-boolean "pull.rebase"))))
(insert (format "%-10s" (or keyword (if rebase "Rebase: " "Merge: "))))
(insert
(cond
(upstream
(concat (and magit-status-show-hashes-in-headers
(concat (propertize (magit-rev-format "%h" upstream)
'font-lock-face 'magit-hash)
" "))
upstream " "
(magit-log--wash-summary
(or (magit-rev-format "%s" upstream)
"(no commit message)"))))
((magit--unnamed-upstream-p remote merge)
(concat (propertize merge 'font-lock-face 'magit-branch-remote)
" from "
(propertize remote 'font-lock-face 'bold)))
((magit--valid-upstream-p remote merge)
(if (equal remote ".")
(concat
(propertize merge 'font-lock-face 'magit-branch-local) " "
(propertize "does not exist"
'font-lock-face 'magit-branch-warning))
(format
"%s %s %s"
(propertize merge 'font-lock-face 'magit-branch-remote)
(propertize "does not exist on"
'font-lock-face 'magit-branch-warning)
(propertize remote 'font-lock-face 'magit-branch-remote))))
((propertize "invalid upstream configuration"
'font-lock-face 'magit-branch-warning))))
(insert ?\n))))))