emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 420b15b869 1/3: magit-remote-head: New function


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 420b15b869 1/3: magit-remote-head: New function
Date: Sun, 21 Aug 2022 14:58:39 -0400 (EDT)

branch: elpa/git-commit
commit 420b15b869c617e6bcba084a35e2213e049270fc
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]