Function: magit-list-refs
magit-list-refs is a byte-compiled function defined in magit-git.el.
Signature
(magit-list-refs &optional NAMESPACES FORMAT SORTBY)
Documentation
Return list of references, excluding symbolic references.
When NAMESPACES is non-nil, list refs from these namespaces
rather than those from magit-list-refs-namespaces.
FORMAT is passed to the --format flag of git for-each-ref
and defaults to "%(refname)".
SORTBY is a key or list of keys to pass to the --sort flag
of git for-each-ref to sort the refs within each namespace.
When nil, use magit-list-refs-sortby. If both are nil, use
"version:refname", but only for "refs/tags".
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-list-refs (&optional namespaces format sortby)
"Return list of references, excluding symbolic references.
When NAMESPACES is non-nil, list refs from these namespaces
rather than those from `magit-list-refs-namespaces'.
FORMAT is passed to the `--format' flag of `git for-each-ref'
and defaults to \"%(refname)\".
SORTBY is a key or list of keys to pass to the `--sort' flag
of `git for-each-ref' to sort the refs within each namespace.
When nil, use `magit-list-refs-sortby'. If both are nil, use
\"version:refname\", but only for \"refs/tags\"."
(let ((format (concat "--format=%(symref)" (or format "%(refname)")))
(sortby (mapcar (##concat "--sort=" %)
(ensure-list (or sortby magit-list-refs-sortby)))))
(seq-keep (lambda (line)
(pcase-let* ((`(,symrefp ,value)
(split-string line ""))
(symrefp (not (equal symrefp ""))))
(and (not symrefp) value)))
(mapcan (lambda (ns)
(if (and (not sortby)
(equal ns "refs/tags"))
(magit-git-lines "for-each-ref" format
"--sort=-version:refname" ns)
(magit-git-lines "for-each-ref" format sortby ns)))
(ensure-list
(or namespaces magit-list-refs-namespaces))))))