summary refs log tree commit diff
path: root/guix/channels.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-09-18 19:32:37 +0200
committerLudovic Courtès <ludo@gnu.org>2021-09-18 19:37:45 +0200
commit778c1fb4eabbb48c05f6c7555c89466d5249ebce (patch)
tree424272dff742ef12238aa4c9aed869590f6dcf4d /guix/channels.scm
parent59ee10754eddddb99e4a80b9e18aa12ed1b3d77a (diff)
downloadguix-778c1fb4eabbb48c05f6c7555c89466d5249ebce.tar.gz
channels: 'channel-news-entry-commit' correctly resolves annotated tags.
Previously, 'channel-news-entry-commit' would return the tag ID rather
than the commit ID when the news entry was referred to via an annotated
tag.

Reported by Xinglu Chen <public@yoctocell.xyz>.

* guix/channels.scm (resolve-channel-news-entry-tag): Check whether the
reference points to annotated tag; resolve it if it does.
* tests/channels.scm ("channel-news, annotated tag"): New test.
Diffstat (limited to 'guix/channels.scm')
-rw-r--r--guix/channels.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/channels.scm b/guix/channels.scm
index 476d62e1f4..e4e0428eb5 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -1089,8 +1089,13 @@ cannot be found."
   (if (channel-news-entry-commit entry)
       entry
       (let* ((tag       (channel-news-entry-tag entry))
-             (reference (string-append "refs/tags/" tag))
-             (oid       (reference-name->oid repository reference)))
+             (reference (reference-lookup repository
+                                          (string-append "refs/tags/" tag)))
+             (target    (reference-target reference))
+             (oid       (let ((obj (object-lookup repository target)))
+                          (if (= OBJ-TAG (object-type obj)) ;annotated tag?
+                              (tag-target-id (tag-lookup repository target))
+                              target))))
         (channel-news-entry (oid->string oid) tag
                             (channel-news-entry-title entry)
                             (channel-news-entry-body entry)))))