diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-12 10:12:10 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-12 10:12:10 +0200 |
| commit | e2cf23c4936a7a6663e70dc6af99efbbab4057d7 (patch) | |
| tree | 7ca2d73505581162273f51b4a201c606897ee5a2 | |
| parent | 7b0c2da9f18c5f44649a64ac5baf52cde7bfc45e (diff) | |
magit-list-refs: Use "version:refname" for "refs/tags"
| -rw-r--r-- | lisp/magit-git.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 7588f09..244b1ec 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1978,7 +1978,8 @@ 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'." +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))))) @@ -1987,7 +1988,12 @@ When nil, use `magit-list-refs-sortby'." (split-string line "")) (symrefp (not (equal symrefp "")))) (and (not symrefp) value))) - (mapcan (##magit-git-lines "for-each-ref" format sortby %) + (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)))))) |
