By moving the bulk of the work to git-branch(1), we can do away with
some ugly string matching.  Performance-wise, it's pretty much a no-op,
but then again, I haven't been able to test it with a remote which has a
ridiculous amount of branches.

Now if only the function were actually used anywhere...
(conceived in 5bfb2164, employed in 73f25ef4, retired in 2107722b)

Signed-off-by: Pieter Praet <[email protected]>
---
 magit.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/magit.el b/magit.el
index d6f0bfc..9a8f0ef 100644
--- a/magit.el
+++ b/magit.el
@@ -6733,13 +6733,9 @@ (defun magit--branch-name-at-point ()
 (defun magit--branches-for-remote-repo (remote)
   "Return a list of remote branch names for REMOTE.
 These are the branch names with the remote name stripped."
-  (cl-mapcan
-   (lambda (line)
-     (save-match-data
-       (when (and (not (string-match-p " -> " line))
-                  (string-match (concat "^ +" remote "/\\([^ $]+\\)") line))
-         (list (match-string 1 line)))))
-   (magit-git-lines "branch" "-r")))
+  (cl-loop for branch in (magit-git-lines "branch" "-r" "--list"
+                                          (format "%s/*" remote))
+           collect (substring branch (+ 3 (length remote)))))
 
 (defvar magit-branches-buffer-name "*magit-branches*")
 
-- 
1.7.11.1

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to