Function: magit-get-indirect-upstream-branch
magit-get-indirect-upstream-branch is a byte-compiled function defined
in magit-git.el.
Signature
(magit-get-indirect-upstream-branch BRANCH &optional FORCE)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-get-indirect-upstream-branch (branch &optional force)
(let ((remote (magit-get "branch" branch "remote")))
(and remote (not (equal remote "."))
;; The user has opted in...
(or force
(seq-some (##if (magit-git-success "check-ref-format" "--branch" %)
(equal % branch)
(string-match-p % branch))
magit-branch-prefer-remote-upstream))
;; and local BRANCH tracks a remote branch...
(let ((upstream (magit-get-upstream-branch branch)))
;; whose upstream...
(and upstream
;; has the same name as BRANCH...
(equal (substring upstream (1+ (length remote))) branch)
;; and can be fast-forwarded to BRANCH.
(magit-rev-ancestor-p upstream branch)
upstream)))))