Function: magit-get-indirect-upstream-branch
magit-get-indirect-upstream-branch is a natively compiled function
defined in magit-git.el.
Signature
(magit-get-indirect-upstream-branch BRANCH &optional FORCE)
Source Code
;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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)))))