branch: elpa/git-commit commit 420b15b869c617e6bcba084a35e2213e049270fc Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-remote-head: New function --- lisp/magit-git.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 297a63ea22..07095caec9 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1972,6 +1972,14 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (substring it 41)) (magit-git-lines "ls-remote" remote))) +(defun magit-remote-head (remote) + (and-let* ((line (cl-find-if + (lambda (line) + (string-match + "\\`ref: refs/heads/\\([^\s\t]+\\)[\s\t]HEAD\\'" line)) + (magit-git-lines "ls-remote" "--symref" remote "HEAD")))) + (match-string 1 line))) + (defun magit-list-modified-modules () (--keep (and (string-match "\\`\\+\\([^ ]+\\) \\(.+\\) (.+)\\'" it) (match-string 2 it))