From patchwork Mon Jun 28 12:56:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 30757 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C938327BC81; Mon, 28 Jun 2021 13:58:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8E0F827BC78 for ; Mon, 28 Jun 2021 13:58:13 +0100 (BST) Received: from localhost ([::1]:49244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxqq4-00021B-Ed for patchwork@mira.cbaines.net; Mon, 28 Jun 2021 08:58:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxqox-00017x-Rd for guix-patches@gnu.org; Mon, 28 Jun 2021 08:57:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxqow-0003OU-Qn for guix-patches@gnu.org; Mon, 28 Jun 2021 08:57:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxqow-0006KY-59; Mon, 28 Jun 2021 08:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49252] [PATCH] Channels defaulting to HEAD instead of =?utf-8?b?4oCYbWFzdGVy4oCZ?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: rekado@elephly.net, kyle@kyleam.com, guix-patches@gnu.org Resent-Date: Mon, 28 Jun 2021 12:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49252 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49252@debbugs.gnu.org Cc: Ricardo Wurmus , Kyle Meyer X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Ricardo Wurmus , Kyle Meyer Received: via spool by submit@debbugs.gnu.org id=B.162488501124317 (code B ref -1); Mon, 28 Jun 2021 12:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jun 2021 12:56:51 +0000 Received: from localhost ([127.0.0.1]:51260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxqol-0006K9-9K for submit@debbugs.gnu.org; Mon, 28 Jun 2021 08:56:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:34630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxqoh-0006Jx-SX for submit@debbugs.gnu.org; Mon, 28 Jun 2021 08:56:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxqoh-0000Z7-Hu for guix-patches@gnu.org; Mon, 28 Jun 2021 08:56:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37434) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxqoh-0003Gj-Ar for guix-patches@gnu.org; Mon, 28 Jun 2021 08:56:47 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=36586 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxqog-0004lY-77 for guix-patches@gnu.org; Mon, 28 Jun 2021 08:56:46 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Messidor an 229 de la =?utf-8?q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 28 Jun 2021 14:56:43 +0200 Message-ID: <87y2auw3jo.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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: 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 . Presumably we have a server-side setup issue at Savannah? Are there downsides, or cases where it might pick the wrong branch? Thoughts? Ludo’. 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