all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’
@ 2021-06-28 12:56 Ludovic Courtès
  2021-07-09  0:38 ` Kyle Meyer
  2021-08-08 13:53 ` Ricardo Wurmus
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2021-06-28 12:56 UTC (permalink / raw)
  To: 49252; +Cc: Ricardo Wurmus, Kyle Meyer

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

Hi,

With an eye on allowing channel authors, and Guix in particular, to
eventually be able to choose a default branch name other than ‘master’,
what about changing defaults like this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1910 bytes --]

diff --git a/guix/channels.scm b/guix/channels.scm
index 476d62e1f4..a5283b4bf4 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -122,7 +122,7 @@
   channel?
   (name      channel-name)
   (url       channel-url)
-  (branch    channel-branch (default "master"))
+  (branch    channel-branch (default #f))
   (commit    channel-commit (default #f))
   (introduction channel-introduction (default #f))
   (location  channel-location
@@ -179,7 +179,6 @@ to the corresponding bytevector."
 (define %default-guix-channel
   (channel
    (name 'guix)
-   (branch "master")
    (url %default-channel-url)
    (introduction %guix-channel-introduction)))
 
@@ -225,7 +224,9 @@ introduction, add it."
   "Return the \"reference\" for CHANNEL, an sexp suitable for
 'latest-repository-commit'."
   (match (channel-commit channel)
-    (#f      `(branch . ,(channel-branch channel)))
+    (#f      (if (channel-branch channel)
+                 `(branch . ,(channel-branch channel))
+                 '()))                            ;remote HEAD
     (commit  `(commit . ,(channel-commit channel)))))
 
 (define sexp->channel-introduction
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 7c8e478f2a..3db63167fd 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -732,7 +732,10 @@ prefix, resolve it; and if 'commit' is unset, fetch CHANNEL's branch tip."
         (branch (channel-branch channel)))
     (if (and commit (= (string-length commit) 40))
         commit
-        (let* ((ref (if commit `(commit . ,commit) `(branch . ,branch)))
+        (let* ((ref (cond
+                     (commit `(commit . ,commit))
+                     (branch `(branch . ,branch))
+                     (else   '())))               ;remote HEAD
                (cache commit relation
                      (update-cached-checkout (channel-url channel)
                                              #:ref ref

[-- Attachment #3: Type: text/plain, Size: 720 bytes --]


For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7 by Kyle
(Cc’d) gives the ability to use the remote HEAD by default, which is
exactly what we need here.

Unfortunately, for the Guix repo at Savannah, I get:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix time-machine -- describe
guix time-machine: error: Git error: reference 'refs/remotes/origin/HEAD' not found
--8<---------------cut here---------------end--------------->8---

… but it works for <https://github.com/guix-mirror/guix>.

Presumably we have a server-side setup issue at Savannah?

Are there downsides, or cases where it might pick the wrong branch?

Thoughts?

Ludo’.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-11  0:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 12:56 [bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’ Ludovic Courtès
2021-07-09  0:38 ` Kyle Meyer
2021-08-04 15:04   ` Ludovic Courtès
2021-08-08 23:28     ` Kyle Meyer
2021-08-09  9:12       ` Ludovic Courtès
2021-08-10  2:10         ` Kyle Meyer
2021-08-10  8:04           ` Ludovic Courtès
2021-08-11  0:34             ` Kyle Meyer
2021-08-08 13:53 ` Ricardo Wurmus
2021-08-08 23:08   ` Kyle Meyer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.