branch: elpa/magit
commit 5cb3492464fee6fc9ee8749f6c70fc72b732cf79
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-format-ref-labels: Don't strip "heads/" if tag name conflicts
---
 CHANGELOG         | 3 +++
 lisp/magit-git.el | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5cb81a1d815..d16768a73db 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,9 @@ Bug fixes:
 - Enabling verbose output in ~magit-commit-absorb~ caused an error.
   #5272
 
+- In logs, no longer strip ~heads/~ prefix from branch names if a tag
+  with the same name exists.
+
 * v4.1.3    2024-12-06
 
 - For most important sections, if an error occurs while inserting the
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 2437bb209f1..c7e64d4f42e 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2309,8 +2309,13 @@ and this option only controls what face is used.")
       (dolist (ref refs)
         (let* ((face (cdr (--first (string-match (car it) ref)
                                    magit-ref-namespaces)))
-               (name (magit--propertize-face
-                      (or (match-string 1 ref) ref) face)))
+               (name (match-string 1 ref))
+               (name (if (and name
+                              (not (string-prefix-p "refs/tags/" ref))
+                              (magit-rev-verify (concat "refs/tags/" name)))
+                         (magit-ref-abbrev ref)
+                       (or name ref)))
+               (name (magit--propertize-face name face)))
           (cl-case face
             ((magit-bisect-bad magit-bisect-skip magit-bisect-good)
              (setq state name))

Reply via email to