branch: elpa/magit commit 4876f1921e203d8c972a692b7ec5a42e1584a456 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-branch-at-point: Cast more section types Support `unpulled', `unpushed' and `pullreq' sections, like `magit-branch-or-commit-at-point' already does. Unlike that function, only return an actual branch for a `pullreq' section, without falling back to "refs/pullreqs/*"; and do not return tags. One set of commands that benefits from this are the reset commands. A convenient way to reset to the upstream branch now is to place the cursor on "Unmerged into {UPSTREAM}" and typing "C-u x RET". --- lisp/magit-git.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 8f0c18be513..64c40706a64 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1509,7 +1509,13 @@ to, or to some other symbolic-ref that points to the same ref." (magit-section-case (branch (oref it value)) (commit (or (magit--painted-branch-at-point) - (magit-name-branch (oref it value)))))) + (magit-name-branch (oref it value)))) + (pullreq (and (fboundp 'forge--pullreq-branch) + (magit-branch-p + (forge--pullreq-branch (oref it value))))) + ((unpulled unpushed) + (magit-ref-abbrev + (replace-regexp-in-string "\\.\\.\\.?" "" (oref it value)))))) (defun magit--painted-branch-at-point (&optional type) (or (and (not (eq type 'remote))