[bug#78030,1/2] guix: channels: Add symref support.

Message ID 6d8680624a6d3c0b30bb93adc0b2a2f86b1463f3.1745482799.git.romain.garbage@inria.fr
State New
Headers
Series Symref support in channels |

Commit Message

Romain GARBAGE April 24, 2025, 8:19 a.m. UTC
  * guix/channels.scm (channel-reference): Add symref support.

Change-Id: Iea93aa22479ec21900af947c4df79a3ed97b5e62
---
 guix/channels.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


base-commit: b12d44dd5e35ac236bf3fbb5619b9c8c2f42c902
  

Patch

diff --git a/guix/channels.scm b/guix/channels.scm
index 4700f7a45d..72450da395 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -250,7 +250,13 @@  (define (channel-reference channel)
   "Return the \"reference\" for CHANNEL, an sexp suitable for
 'latest-repository-commit'."
   (match (channel-commit channel)
-    (#f      `(branch . ,(channel-branch channel)))
+    (#f      (let ((branch (channel-branch channel)))
+               (cond
+                ((and (string? branch)
+                      (string-prefix? "refs/"
+                                      branch))
+                 `(symref . ,branch))
+                (#t `(branch . ,branch)))))
     (commit  `(tag-or-commit . ,(channel-commit channel)))))
 
 (define sexp->channel-introduction