GNU bug report logs - #49252
[PATCH] Channels defaulting to HEAD instead of ‘master’

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Ludovic Courtès <ludo@HIDDEN>; Keywords: patch; dated Mon, 28 Jun 2021 12:57:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 7 Jan 2026 14:42:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 09:42:51 2026
Received: from localhost ([127.0.0.1]:35407 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdUkM-00021m-P7
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:42:51 -0500
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:42152)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1vdUkJ-00021a-I3
 for 49252 <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:42:48 -0500
Received: by mail-wm1-x332.google.com with SMTP id
 5b1f17b1804b1-47774d3536dso8787705e9.0
 for <49252 <at> debbugs.gnu.org>; Wed, 07 Jan 2026 06:42:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767796966; x=1768401766; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=XsLdhT9aSjQDha1pulbpV0748fB8HfVwpqb5ijXXkIE=;
 b=YvvavjLinTmcuhJ74wJC29b9tNybbuS3WYfFbegr7/FWh5TL4C71Yszw9ZuFTWN3g/
 4/DAbBWR9Pagi47KQY0nbKDWbBxTamS1nPomsQp8jKrkJ+X8BQM509vIpm2qsDqtQDHO
 POOnhaf5qDzSePl3FrrkqJsm5tQ6qK5w9ufMevXj0YU4+Gtl4KWXyUOfsPXtA6+sYLQ3
 lEqyx6JvURN0KFnUvMpNJsqfPsJR/fIV15OtxxgG0o//WnEgvvZSAtkQI40aBZ3uj6JL
 ZYQbyU74dlnQ1k6cgHJ5sM4zTGWyFFFEUiiJEkwqlGhy2NBbME35gblnpQT12kxHiWl8
 mNTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767796966; x=1768401766;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=XsLdhT9aSjQDha1pulbpV0748fB8HfVwpqb5ijXXkIE=;
 b=VRjrcdIqqJC/V6cSKWRMsvdZB57w8B1Tri2naHGEKohTE0/r16KYKVA1CA0XwFzdEc
 39j8e8oZid6nEY0OU1NHBcZu4MKSQQYn/uWuKBKga4A7t7rdacbcaClueiTV1FcFs7hK
 WRhrOjZuxn+el2njxr9kyjLK+l8ZSxO+L9lneWIUuJuyjuxQdrV1aSXzO+p2uFQuFjla
 CfQHdj5rUW7PX6CVbGSsoAa36IqJoiXDFq5OCO0bOtu58H2w6lbKaD2NIqCyHVNZDbrv
 +Pe91PE/vKOH++NzrRCxJiMwRfIsS/etHi0GZS3cMU5wTACGVvSnSoXlojdqRREaBFe+
 0v1w==
X-Forwarded-Encrypted: i=1;
 AJvYcCVzaN/UJi+tq9b87lWSfb1x1HzdrixO6451Jrw3fjf3ns8ChCRt3guJPjfsW53krXCbO24olw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyWM4U/NBDNxWvOZvb7qLOJr5uOzrsWNV0QvgvzpexmEVeu0RPv
 geLMELOoDMZjsv+8K14oWyI4M4JqLPdckl2Rp1n7Z+XeTAaGDCsaQCTxmZRRFA==
X-Gm-Gg: AY/fxX4tDPHvlFboM8NEhm9NujU/+24c4SKUa97XwhwGcRj5MfumsReK35Fu2F01uIk
 YQuYugJeaTb9lhrERjntCIQXufii/lgowNCK71+zGqg+Yh9KccIb9Tn2kSpPNd2vIrhlE6eHWNP
 8LHSybbYel+clXj4A8QpCPrKP90pxYYINC28t24noF8GvlqbU0NPza2ZG8abDGk7Lun7utgH41A
 AQvUeSYy8Y5m6T0YBuQUGWyCikUC2beDhtNUhX6UXYxiP4dfEC+hHCr5KywcLf4Hro7Lfl9pAVL
 8gzIxzgT4Xte72/mmReAoe8AstUtCWROcDDXXAEGOjepOZehaeFR7B9rmecwwuWLAOKnTtaQDMc
 SuxwVFXppulxKjvMj0zQoEH/Xzt4PRBXseGqB7Si3Ua7mwOkloUxQRQcuAws+NsfmnY+0BPTJvU
 zM6aV1vRQUYTdRMujuugu0qR6PjrtSDtIw7/sfg50pJ7wpKkO5BmwuCCIP+Q==
X-Google-Smtp-Source: AGHT+IEAczBBGA93yOlMB4X5K7yPApfgRksq3ab2w9L90gby/2uBooL521nPTuLueuOwy1uEsgEQuQ==
X-Received: by 2002:a05:600c:3d96:b0:47d:403a:277 with SMTP id
 5b1f17b1804b1-47d8483cc42mr25184815e9.4.1767796966000; 
 Wed, 07 Jan 2026 06:42:46 -0800 (PST)
Received: from lili (nat-dsi-209.net.univ-paris-diderot.fr. [81.194.30.209])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-432bd5ee870sm10625838f8f.36.2026.01.07.06.42.44
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 07 Jan 2026 06:42:45 -0800 (PST)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87r1f1sp2x.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Tue, 10 Aug 2021 10:04:22 +0200")
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN> <87k0kv8qka.fsf@HIDDEN>
 <87wnovyobb.fsf@HIDDEN> <87h7fyhwwj.fsf@HIDDEN>
 <87r1f1sp2x.fsf@HIDDEN>
Date: Wed, 07 Jan 2026 15:42:33 +0100
Message-ID: <87bjj5scva.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, Kyle Meyer <kyle@HIDDEN>,
 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

For more context, see:

    https://issues.guix.gnu.org/issue/49252

On Tue, 10 Aug 2021 at 10:04, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

>> ... I guess it might be possible to determine the ref target with
>> remote-ls.  In that case, it'd just be the
>> git_reference_symbolic_create() wrapper that was missing.
>
> Right.  We can add the missing procedures in Guile-Git, but in the
> meantime, maybe we could create .git/refs/origin/HEAD =E2=80=9Cby hand=E2=
=80=9D?  The
> advantage is that we wouldn=E2=80=99t have to wait for the new Guile-Git
> release; but OTOH, we=E2=80=99re the ones making the Guile-Git release, t=
oo=E2=80=A6

The wrapper had been introduced some months ago. \o/

--8<---------------cut here---------------start------------->8---
3b01be2718492ec0278c6b537fd9553696194cba
Author:     Romain GARBAGE <romain.garbage@HIDDEN>
CommitDate: Mon Sep 1 16:21:51 2025 +0200

reference: Add reference-symbolic-create procedure.

* git/reference.scm (reference-symbolic-create): New variable.
* tests/reference.scm: Add test for reference-symbolic-create.

2 files changed, 47 insertions(+), 2 deletions(-)
git/reference.scm   | 27 ++++++++++++++++++++++++++-
tests/reference.scm | 22 +++++++++++++++++++++-
--8<---------------cut here---------------end--------------->8---

What=E2=80=99s the next steps with the patch defaulting to HEAD instead of
=E2=80=99master=E2=80=99?

Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 11 Aug 2021 00:35:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 10 20:35:12 2021
Received: from localhost ([127.0.0.1]:32819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mDcD6-0005FC-7t
	for submit <at> debbugs.gnu.org; Tue, 10 Aug 2021 20:35:12 -0400
Received: from out0.migadu.com ([94.23.1.103]:52141)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kyle@HIDDEN>) id 1mDcD0-0005Ej-JM
 for 49252 <at> debbugs.gnu.org; Tue, 10 Aug 2021 20:35:07 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1;
 t=1628642100;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=lWw3jSE2qpRMgcc0MG9K6uKLN4id4Mhi3251RlOcBmg=;
 b=UVgNgWVlfhrteA6JfuKXkoDze5Z3uzXIbV+EOo4QDxZ0dpCKPlXSE6N6lKfQzibLVizRym
 ssAIvWDnEnqHrP2eLUEfmxIbG0RfW8aYa34ylVZD6SeIHMISYmbwZl+wJRamtL+fKid85Y
 yxK+2JQ91B5RVBBLt7gNwUgbRvmciumUwN3Y/iNtaUe9DlpgMTUNpdtg//EisHCbs5A2Ka
 lA+wUaT3JL0ZrIHxG1ZzPMXY4+nWI5CNmy3pSOFp32Xo5i4kEeWH38LAdTkyrYyQceBqqp
 pU6UG3pKQzHR+mGzRrzTnebjmOILmBaW71aKjQecVeqGEploG/5TaYTl1S0hgQ==
From: Kyle Meyer <kyle@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87r1f1sp2x.fsf@HIDDEN>
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN> <87k0kv8qka.fsf@HIDDEN>
 <87wnovyobb.fsf@HIDDEN> <87h7fyhwwj.fsf@HIDDEN>
 <87r1f1sp2x.fsf@HIDDEN>
Date: Tue, 10 Aug 2021 20:34:58 -0400
Message-ID: <87czqkizt9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: kyle@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Ludovic Court=C3=A8s writes:

> Right.  We can add the missing procedures in Guile-Git, but in the
> meantime, maybe we could create .git/refs/origin/HEAD =E2=80=9Cby hand=E2=
=80=9D?

Yep, for the default branch $NAME, "ref: refs/remotes/origin/$NAME\n"
can be written to .git/refs/origin/HEAD.

With respect to getting the default branch, I said in my last message
that I thought it'd be possible to glean the target from the remote-ls
output.  To flesh that out a bit:

--8<---------------cut here---------------start------------->8---
(use-modules
 (git)
 (system foreign))

(define origin (remote-lookup (repository-open ".") "origin"))
(remote-connect origin)

(define head (car (remote-ls origin)))

(define target-pt
  (make-pointer
   ((record-accessor (record-type-descriptor head) 'symref-target)
    head)))

(if (not (null-pointer? target-pt))
    (display (pointer->string target-pt)))  ;; =3D> refs/heads/master
--8<---------------cut here---------------end--------------->8---

And that looks like it matches what libgit2's
git_remote_default_branch() does for the non-guessing case (see below),
so stopping there may be sufficient for a compatibility kludge.

--8<---------------cut here---------------start------------->8---
	if ((error =3D git_remote_ls(&heads, &heads_len, remote)) < 0)
		goto done;

	if (heads_len =3D=3D 0 || strcmp(heads[0]->name, GIT_HEAD_FILE)) {
		error =3D GIT_ENOTFOUND;
		goto done;
	}

	if ((error =3D git_buf_sanitize(out)) < 0)
		return error;

	/* the first one must be HEAD so if that has the symref info, we're done */
	if (heads[0]->symref_target) {
		error =3D git_buf_puts(out, heads[0]->symref_target);
		goto done;
	}

	/*
	 * If there's no symref information, we have to look over them
	 * and guess. We return the first match unless the default
	 * branch is a candidate. Then we return the default branch.
*/--8<---------------cut here---------------end--------------->8---




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 10 Aug 2021 08:04:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 10 04:04:33 2021
Received: from localhost ([127.0.0.1]:58391 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mDMkT-0004mT-Jl
	for submit <at> debbugs.gnu.org; Tue, 10 Aug 2021 04:04:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:50416)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1mDMkR-0004mG-8A
 for 49252 <at> debbugs.gnu.org; Tue, 10 Aug 2021 04:04:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41556)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1mDMkL-0004qx-50; Tue, 10 Aug 2021 04:04:25 -0400
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=45048 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mDMkK-0007jT-RO; Tue, 10 Aug 2021 04:04:25 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Kyle Meyer <kyle@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN> <87k0kv8qka.fsf@HIDDEN>
 <87wnovyobb.fsf@HIDDEN> <87h7fyhwwj.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 23 Thermidor 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: Tue, 10 Aug 2021 10:04:22 +0200
In-Reply-To: <87h7fyhwwj.fsf@HIDDEN> (Kyle Meyer's message of "Mon, 09 Aug
 2021 22:10:52 -0400")
Message-ID: <87r1f1sp2x.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Kyle Meyer <kyle@HIDDEN> skribis:

> Ludovic Court=C3=A8s writes:
>
>> Oh, this must be the reason.  If I remove the cached clone:
>>
>>   rm -rf ~/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr2=
7shj7apsnalwq
>>
>> and then clone again, it works:
>
> Great, glad that that mystery is solved.
>
>> I suppose we need to add a call to fetch remote heads when they=E2=80=99=
re
>> missing?  It seems that calling =E2=80=98remote-fetch=E2=80=99 is not en=
ough.
>
> Right, a fetch won't do it [1].  Users are free to delete or redirect
> refs/remotes/<remote>/HEAD, and a fetch won't repopulate it.
>
> On the command line, you can query the remote and recreate the symref
> with `remote set-head <remote> -a':
>
>   $ git symbolic-ref -d refs/remotes/origin/HEAD
>   $ git symbolic-ref refs/remotes/origin/HEAD
>   fatal: ref refs/remotes/origin/HEAD is not a symbolic ref
>   $ git remote set-head origin -a
>   origin/HEAD set to master
>   $ git symbolic-ref refs/remotes/origin/HEAD
>   refs/remotes/origin/master
>
> In the libgit2 world, I think the most direct path might be something
> along the lines of "get remote ref via git_remote_default_branch()"
> followed by "create refs/remotes/<remote>/HEAD via
> git_reference_symbolic_create()".  I'm not spotting either of those
> functions in guile-git, though.
>
> I haven't confirmed but based on the "symref-target" in the remote-ls
> output you showed...
>
>> --8<---------------cut here---------------start------------->8---
>> scheme@(guile-user)> (define o (remote-lookup r "origin"))
>> scheme@(guile-user)> (remote-connect o)
>> scheme@(guile-user)> (remote-ls o)
>> $13 =3D (#<<remote-head> local: 0 oid: #<oid 00000000742ebc4bc09ce69b970=
eceb78291bdbf> loid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> name: =
"HEAD" symref-target: 73408368> [...]
>
> ... I guess it might be possible to determine the ref target with
> remote-ls.  In that case, it'd just be the
> git_reference_symbolic_create() wrapper that was missing.

Right.  We can add the missing procedures in Guile-Git, but in the
meantime, maybe we could create .git/refs/origin/HEAD =E2=80=9Cby hand=E2=
=80=9D?  The
advantage is that we wouldn=E2=80=99t have to wait for the new Guile-Git
release; but OTOH, we=E2=80=99re the ones making the Guile-Git release, too=
=E2=80=A6

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 10 Aug 2021 02:11:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 09 22:11:01 2021
Received: from localhost ([127.0.0.1]:58116 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mDHEL-0004Bk-5H
	for submit <at> debbugs.gnu.org; Mon, 09 Aug 2021 22:11:01 -0400
Received: from out0.migadu.com ([94.23.1.103]:34148)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kyle@HIDDEN>) id 1mDHEG-0004BZ-DL
 for 49252 <at> debbugs.gnu.org; Mon, 09 Aug 2021 22:10:59 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1;
 t=1628561454;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=5WWiduhnLh7N0EgPWm/OxfougAI0y+UIp88dseiaX5c=;
 b=N94X7TOk/UyQ9/2D6/pfB6s20QY6RDPUAp6Yaj6a/Ffq3wDEsrHHO08ID6ID/01PWRsaBm
 9mrgaNOy2yZCDk73eWmgIvwXuQmYiclJkEAF2WHQkYJqAewdTFIjkCmnQmZ00wj/ppgw8A
 0bCTkZdWHbfdt/B8iaDjMgrnQYqjlnYct7OFvMBZy3XN0LPn/6xgkSk+UJg+zoxPk+UOOk
 WH6kaWjRI8GkU3PNr40P35KqmCOfgfLBFIgxrlslYSSTo3GbwXgvC6IBwPmLhnpFP+GpJA
 N2jAKuQgMCLbLo90HdZ88zp61IZ+92ROEhkf4+hifa7f9PYOSCzup7i6ZSi26Q==
From: Kyle Meyer <kyle@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87wnovyobb.fsf@HIDDEN>
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN> <87k0kv8qka.fsf@HIDDEN>
 <87wnovyobb.fsf@HIDDEN>
Date: Mon, 09 Aug 2021 22:10:52 -0400
Message-ID: <87h7fyhwwj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: kyle@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Ludovic Court=C3=A8s writes:

> Oh, this must be the reason.  If I remove the cached clone:
>
>   rm -rf ~/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27=
shj7apsnalwq
>
> and then clone again, it works:

Great, glad that that mystery is solved.

> I suppose we need to add a call to fetch remote heads when they=E2=80=99re
> missing?  It seems that calling =E2=80=98remote-fetch=E2=80=99 is not eno=
ugh.

Right, a fetch won't do it [1].  Users are free to delete or redirect
refs/remotes/<remote>/HEAD, and a fetch won't repopulate it.

On the command line, you can query the remote and recreate the symref
with `remote set-head <remote> -a':

  $ git symbolic-ref -d refs/remotes/origin/HEAD
  $ git symbolic-ref refs/remotes/origin/HEAD
  fatal: ref refs/remotes/origin/HEAD is not a symbolic ref
  $ git remote set-head origin -a
  origin/HEAD set to master
  $ git symbolic-ref refs/remotes/origin/HEAD
  refs/remotes/origin/master

In the libgit2 world, I think the most direct path might be something
along the lines of "get remote ref via git_remote_default_branch()"
followed by "create refs/remotes/<remote>/HEAD via
git_reference_symbolic_create()".  I'm not spotting either of those
functions in guile-git, though.

I haven't confirmed but based on the "symref-target" in the remote-ls
output you showed...

> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (define o (remote-lookup r "origin"))
> scheme@(guile-user)> (remote-connect o)
> scheme@(guile-user)> (remote-ls o)
> $13 =3D (#<<remote-head> local: 0 oid: #<oid 00000000742ebc4bc09ce69b970e=
ceb78291bdbf> loid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> name: "=
HEAD" symref-target: 73408368> [...]

... I guess it might be possible to determine the ref target with
remote-ls.  In that case, it'd just be the
git_reference_symbolic_create() wrapper that was missing.


[1] In addition to the link I gave upthread, see
    <https://lore.kernel.org/git/20180601065121.GA15578@HIDDEN=
et/>
    for some discussion about whether fetch should populate it.




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 9 Aug 2021 09:12:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 09 05:12:21 2021
Received: from localhost ([127.0.0.1]:55739 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mD1KW-0000iw-QX
	for submit <at> debbugs.gnu.org; Mon, 09 Aug 2021 05:12:21 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1mD1KU-0000ii-0F
 for 49252 <at> debbugs.gnu.org; Mon, 09 Aug 2021 05:12:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34390)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1mD1KN-0000cB-7u; Mon, 09 Aug 2021 05:12:11 -0400
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=45038 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mD1KM-0005f8-VJ; Mon, 09 Aug 2021 05:12:11 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Kyle Meyer <kyle@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN> <87k0kv8qka.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 22 Thermidor 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, 09 Aug 2021 11:12:08 +0200
In-Reply-To: <87k0kv8qka.fsf@HIDDEN> (Kyle Meyer's message of "Sun, 08 Aug
 2021 19:28:05 -0400")
Message-ID: <87wnovyobb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello Kyle,

Kyle Meyer <kyle@HIDDEN> skribis:

> Ludovic Court=C3=A8s writes:
>
>> Kyle Meyer <kyle@HIDDEN> skribis:
> [...]
>>>
>>> Hmm, it looks like it's there:
>>>
>>>   $ git ls-remote https://git.savannah.gnu.org/git/guix.git | grep HEAD
>>>   e499500730de23fd54ae63696a725d4b90a406d7	HEAD
>>>
>>>   $ git clone https://git.savannah.gnu.org/git/guix.git && cd guix
>>>   $ git for-each-ref refs/remotes/origin | grep HEAD
>>>   e499500730de23fd54ae63696a725d4b90a406d7 commit	refs/remotes/origin/H=
EAD
>>>   $ git name-rev refs/remotes/origin/HEAD
>>>   refs/remotes/origin/HEAD master
>>
>> OK, so something else must be at fault.
>>
>> Ideas?
>
> My understanding is that the clone is happening through guile-git, which
> uses libgit2.  In libgit2's v1.1.0 release notes, I see "[t]he
> refs/remotes/origin/HEAD file will be created at clone time to point to
> the origin's default branch".  So my current guess is that this clone
> was made before guix's libgit2 was 1.1.0.
>
> Does that sound possible (i.e. this clone is from before 2020-12-ish)?
> Do you still see the "reference 'refs/remotes/origin/HEAD' not found"
> failure if you force a fresh clone?

Oh, this must be the reason.  If I remove the cached clone:

  rm -rf ~/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27sh=
j7apsnalwq

and then clone again, it works:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix git)
scheme@(guile-user)> (update-cached-checkout "https://git.savannah.gnu.org/=
git/guix.git")
$2 =3D "/home/ludo/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywm=
isyr27shj7apsnalwq"
$3 =3D "30289f4d4638452520f52c1a36240220d0d940ff"
$4 =3D #f
--8<---------------cut here---------------end--------------->8---

Likewise with the other repo Ricardo mentions:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (update-cached-checkout "https://github.com/ImmuneDyna=
mics/Spectre")
$5 =3D "/home/ludo/.cache/guix/checkouts/lpz4iyuu3pztx73ks74bfiymewyzn24rm5=
65l6cgiutvjow5joka"
$6 =3D "742ebc4bc09ce69b970eceb78291bdbf5229d20d"
$7 =3D #f
--8<---------------cut here---------------end--------------->8---

I suppose we need to add a call to fetch remote heads when they=E2=80=99re
missing?  It seems that calling =E2=80=98remote-fetch=E2=80=99 is not enoug=
h.  If I
explicitly remove =E2=80=98HEAD=E2=80=99 from the clone, then I get:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define r (repository-open "/home/ludo/.cache/guix/che=
ckouts/lpz4iyuu3pztx73ks74bfiymewyzn24rm565l6cgiutvjow5joka"))
scheme@(guile-user)> (reference-name->oid r "refs/remotes/origin/HEAD")
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Git error: reference 'refs/remotes/origin/HEAD' not found


Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (remote-fetch (remote-lookup r "origin"))
scheme@(guile-user)> (reference-name->oid r "refs/remotes/origin/HEAD")
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Git error: reference 'refs/remotes/origin/HEAD' not found


Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
--8<---------------cut here---------------end--------------->8---

Calling =E2=80=98remote-ls=E2=80=99 doesn=E2=80=99t populate that file eith=
er:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define o (remote-lookup r "origin"))
scheme@(guile-user)> (remote-connect o)
scheme@(guile-user)> (remote-ls o)
$13 =3D (#<<remote-head> local: 0 oid: #<oid 00000000742ebc4bc09ce69b970ece=
b78291bdbf> loid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> name: "HE=
AD" symref-target: 73408368> #<<remote-head> local: 0 oid: #<oid 00000000c9=
d6e28e5d48c056ee6ad36cc4ab0861> loid: #<oid 00000000c9d6e28e5d48c056ee6ad36=
cc4ab0861> name: "refs/heads/development" symref-target: 0> #<<remote-head>=
 local: 0 oid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> loid: #<oid =
00000000742ebc4bc09ce69b970eceb78291bdbf> name: "refs/heads/master" symref-=
target: 0> #<<remote-head> local: 0 oid: #<oid 00000000e6985cce0e75b63dab30=
32ae875f5592> loid: #<oid 00000000e6985cce0e75b63dab3032ae875f5592> name: "=
refs/heads/pre-release" symref-target: 0> [=E2=80=A6])
--8<---------------cut here---------------end--------------->8---

So I=E2=80=99m not sure what the best approach is.  Thoughts?

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 8 Aug 2021 23:28:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 08 19:28:10 2021
Received: from localhost ([127.0.0.1]:54941 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mCsDC-0000fG-2l
	for submit <at> debbugs.gnu.org; Sun, 08 Aug 2021 19:28:10 -0400
Received: from out1.migadu.com ([91.121.223.63]:41179)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kyle@HIDDEN>) id 1mCsDA-0000f7-FM
 for 49252 <at> debbugs.gnu.org; Sun, 08 Aug 2021 19:28:09 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1;
 t=1628465286;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=L4peNXilfvPJNk81AET5TFEy8P3NhGAZLxXqrb3LoQI=;
 b=m5wopfA45v32uVEw4MAEFt1w3TwBEx3QUeZLt3Xe7vJrcvqCJqIF5LzGR1m9azKuS14UdI
 Ks+RgcjB12xDF8p1w4WpY7w+Ke/7ZZKDseXj2Fkvxnev+bsKziDgTDfjf7T3jLC3zGu1Pb
 fU4eZaOVVykPzmv/j0gXNrBdwaiHROeG97JaZk5/0/DVMNwSFxxvRzdxM4T2YVqxD6RJSc
 fR3vcHiaffw8BtLY2Mtv515fP5my2m8UAKZXnm/YYPKbnoHtjNTqqIwjldrurGVvmlW70o
 U3ri8ibeKshERcLF92MkN5+MLbWhpmlLDkAJ0+APcFt7IZ2rY4FHiWsexiO/4A==
From: Kyle Meyer <kyle@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87h7g5p7yi.fsf@HIDDEN>
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
 <87h7g5p7yi.fsf@HIDDEN>
Date: Sun, 08 Aug 2021 19:28:05 -0400
Message-ID: <87k0kv8qka.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: kyle@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Ludovic Court=C3=A8s writes:

> Kyle Meyer <kyle@HIDDEN> skribis:
[...]
>>
>> Hmm, it looks like it's there:
>>
>>   $ git ls-remote https://git.savannah.gnu.org/git/guix.git | grep HEAD
>>   e499500730de23fd54ae63696a725d4b90a406d7	HEAD
>>
>>   $ git clone https://git.savannah.gnu.org/git/guix.git && cd guix
>>   $ git for-each-ref refs/remotes/origin | grep HEAD
>>   e499500730de23fd54ae63696a725d4b90a406d7 commit	refs/remotes/origin/HE=
AD
>>   $ git name-rev refs/remotes/origin/HEAD
>>   refs/remotes/origin/HEAD master
>
> OK, so something else must be at fault.
>
> Ideas?

My understanding is that the clone is happening through guile-git, which
uses libgit2.  In libgit2's v1.1.0 release notes, I see "[t]he
refs/remotes/origin/HEAD file will be created at clone time to point to
the origin's default branch".  So my current guess is that this clone
was made before guix's libgit2 was 1.1.0.

Does that sound possible (i.e. this clone is from before 2020-12-ish)?
Do you still see the "reference 'refs/remotes/origin/HEAD' not found"
failure if you force a fresh clone?




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 8 Aug 2021 23:08:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 08 19:08:15 2021
Received: from localhost ([127.0.0.1]:54925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mCrtv-0000CF-Kw
	for submit <at> debbugs.gnu.org; Sun, 08 Aug 2021 19:08:15 -0400
Received: from out0.migadu.com ([94.23.1.103]:29945)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kyle@HIDDEN>) id 1mCrtp-0000C3-UU
 for 49252 <at> debbugs.gnu.org; Sun, 08 Aug 2021 19:08:14 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1;
 t=1628464088;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=bQah+k/CFLK2YqJ1w/jdTKsMNIBry1PepJXi9lmFTmo=;
 b=laabB9I1FfDdbBoWmII6ZHbIRXAYEXuBejFoP27zLspn3TcESH3kdd6EICBZ5mutNtg0rh
 ingB+o/fdCt1+j9tbvDmf6S7Uw4E3n0+X5YGYgzpUmCml1ENgS7CCfzxX8dOo771Z5a6Hk
 kSoEIa1nENjtEIDuOEnbBMDlna1vWHF7wFOflunruZBEes1IwI66t53fsyD6o1/9xFCwsQ
 2AjUWS2AgKSkXlQiCGwrBPtVbCIKn8XMLE5sAMqe65wVwTxHfSmgyTpk6m6MCMWCZjEg68
 Bq4lzylJUp3KomqAvEvYvOe9wb2SbhdQYHSrb6Y5hf+xGNBYac50O96Y/WDeAw==
From: Kyle Meyer <kyle@HIDDEN>
To: Ricardo Wurmus <rekado@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87tuk0kpoz.fsf@HIDDEN>
References: <87y2auw3jo.fsf@HIDDEN> <87tuk0kpoz.fsf@HIDDEN>
Date: Sun, 08 Aug 2021 19:08:06 -0400
Message-ID: <87mtpr8rhl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: kyle@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Ricardo Wurmus writes:

> For what it=E2=80=99s worth I found the same kind of problem when=20
> importing an R package from Github:
>
>    ./pre-inst-env guix import cran -a git=20
>    https://github.com/ImmuneDynamics/Spectre
>
> Here=E2=80=99s the error backtrace:
[...]
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Git error: reference 'refs/remotes/origin/HEAD' not found
> --8<---------------cut here---------------end--------------->8---
>
>> Presumably we have a server-side setup issue at Savannah?
>
> I think it might be a repository setting rather than a server=20
> setting as other Github repositories work, yet this one repo on=20
> Github does not.

Hmm, I'm not sure what's going on here, but, as with
<https://git.savannah.gnu.org/git/guix.git>, if I clone the above repo
via `git clone', refs/remotes/origin/HEAD is there:

  $ git ls-remote https://github.com/ImmuneDynamics/Spectre | grep HEAD
  742ebc4bc09ce69b970eceb78291bdbf5229d20d	HEAD

  $ git clone https://github.com/ImmuneDynamics/Spectre && cd Spectre
  $ git for-each-ref refs/remotes/origin | grep HEAD
  742ebc4bc09ce69b970eceb78291bdbf5229d20d commit	refs/remotes/origin/HEAD




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 8 Aug 2021 13:54:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 08 09:54:09 2021
Received: from localhost ([127.0.0.1]:53823 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mCjFh-0003tu-BV
	for submit <at> debbugs.gnu.org; Sun, 08 Aug 2021 09:54:09 -0400
Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21147)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1mCjFd-0003ti-GO
 for 49252 <at> debbugs.gnu.org; Sun, 08 Aug 2021 09:54:08 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1628430834; cv=none; 
 d=zohomail.com; s=zohoarc; 
 b=MEYbCYv9/ALXR4rmTBAs1T6jnAVrhvzWoo7O1xuoPqC0TA8LY60msZliS3c2r94Tgi1MP8DRB93Is/UtW6BRhe1AgSkJbWtce+kjmlE47pW7zyDYdSdVHWGeAb8dEyYRs4sA1nMnKxChtvAqPIdYzhgVpgzmauLKJKOA7mbD0g4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc; t=1628430834;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To;
 bh=8RIYCFAx0K2eVi3PZff5cQvQW1/vybM0Gu4TjdHVoR8=; 
 b=GlVIodcS0AVfblkGc6p6glygKRqdvKEL8P5B/txjWzPfdY7XWYOUMfKjmaQGe3GP8IRf9bJPMs+19vtRIroW+B2ytNC5AuWwS4FZWwXD+z1lM1wYYrvQDI/PRUse5tJPDmEwMwp499FcrX/da/+ITHJaNFAbwbLQJskrISxxZlE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
 dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1628430834; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 bh=8RIYCFAx0K2eVi3PZff5cQvQW1/vybM0Gu4TjdHVoR8=;
 b=i5k4hU+xShBayKSiMTlH3EEExsYlRRCoBKaU8QKhw5A4Z5NDTlzOB71gWX9OVc/6
 mUu+52U+zO2vbEzJd0eRnS6PMLmTX/pNf9DYqVPwW8n788yKp6AKX4lIg9F1bgdFeNT
 KfADNultFFS4loHglkzmE/JV7swe5SIvkFQKqcRc=
Received: from localhost (p54ad4ea5.dip0.t-ipconnect.de [84.173.78.165]) by
 mx.zohomail.com with SMTPS id 162843083183143.647378345185075;
 Sun, 8 Aug 2021 06:53:51 -0700 (PDT)
References: <87y2auw3jo.fsf@HIDDEN>
User-agent: mu4e 1.4.15; emacs 27.2
From: Ricardo Wurmus <rekado@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-reply-to: <87y2auw3jo.fsf@HIDDEN>
X-URL: https://elephly.net
X-PGP-Key: https://elephly.net/rekado.pubkey
X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
Date: Sun, 08 Aug 2021 15:53:48 +0200
Message-ID: <87tuk0kpoz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-ZohoMailClient: External
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 49252
Cc: Kyle Meyer <kyle@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7=20
> by Kyle
> (Cc=E2=80=99d) gives the ability to use the remote HEAD by default,=20
> which is
> exactly what we need here.
>
> Unfortunately, for the Guix repo at Savannah, I get:
>
> --8<---------------cut=20
> here---------------start------------->8---
> $ ./pre-inst-env guix time-machine -- describe
> guix time-machine: error: Git error: reference=20
> 'refs/remotes/origin/HEAD' not found
> --8<---------------cut=20
> here---------------end--------------->8---
>
> =E2=80=A6 but it works for <https://github.com/guix-mirror/guix>.

For what it=E2=80=99s worth I found the same kind of problem when=20
importing an R package from Github:

   ./pre-inst-env guix import cran -a git=20
   https://github.com/ImmuneDynamics/Spectre

Here=E2=80=99s the error backtrace:

--8<---------------cut here---------------start------------->8---
Backtrace:
In ice-9/boot-9.scm:
    724:2 19 (call-with-prompt _ _ #<procedure=20
    default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8 18 (_ #(#(#<directory (guile-user) 7f95f8626c80>)))
In guix/ui.scm:
   2185:7 17 (run-guix . _)
  2148:10 16 (run-guix-command _ . _)
In guix/scripts/import.scm:
   120:11 15 (guix-import . _)
In guix/scripts/import/cran.scm:
   110:25 14 (guix-import-cran . _)
In guix/memoization.scm:
     98:0 13 (mproc "https://github.com/ImmuneDynamics/Spectre"=20
     #:repo git)
In unknown file:
          12 (_ #<procedure 7f95f4ce5e60 at=20
          guix/memoization.scm:179:32 ()> #<procedure list _>=20
          (this is nothing))
In guix/import/cran.scm:
   594:24 11 (_ "https://github.com/ImmuneDynamics/Spectre" #:repo=20
   _ #:version _)
   279:25 10 (fetch-description _=20
   "https://github.com/ImmuneDynamics/Spectre")
In guix/memoization.scm:
     98:0  9 (mproc "https://github.com/ImmuneDynamics/Spectre"=20
     #:method git)
In unknown file:
           8 (_ #<procedure 7f95f4ce5e00 at=20
           guix/memoization.scm:179:32 ()> #<procedure list _>=20
           (this is nothing))
In ice-9/boot-9.scm:
  1752:10  7 (with-exception-handler _ _ #:unwind? _=20
  #:unwind-for-type _)
In guix/store.scm:
   658:37  6 (thunk)
In guix/git.scm:
    481:8  5 (latest-repository-commit #<store-connection 256.99=20
    7f95f4c18320> "https://github.com/ImmuneDynamics/Spectre"=20
    #:recursive? _ #:log-port _ #:cache-directory _ #:ref _)
    247:4  4 (update-cached-checkout _ #:ref _ #:recursive? _=20
    #:check-out? _ #:starting-commit _ #:log-port _=20
    #:cache-directory _)
   214:18  3 (resolve _)
In git/reference.scm:
     60:8  2 (_ _ _)
In git/bindings.scm:
     77:2  1 (raise-git-error _)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Git error: reference 'refs/remotes/origin/HEAD' not found
--8<---------------cut here---------------end--------------->8---

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

I think it might be a repository setting rather than a server=20
setting as other Github repositories work, yet this one repo on=20
Github does not.

--=20
Ricardo




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 4 Aug 2021 15:04:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 04 11:04:31 2021
Received: from localhost ([127.0.0.1]:44927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mBIRb-0007wd-LF
	for submit <at> debbugs.gnu.org; Wed, 04 Aug 2021 11:04:31 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59182)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1mBIRa-0007wS-By
 for 49252 <at> debbugs.gnu.org; Wed, 04 Aug 2021 11:04:30 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:33790)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1mBIRT-0002gF-Na; Wed, 04 Aug 2021 11:04:23 -0400
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=43034 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mBIRT-0000WC-5j; Wed, 04 Aug 2021 11:04:23 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Kyle Meyer <kyle@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
References: <87y2auw3jo.fsf@HIDDEN> <87fswo8goa.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 17 Thermidor 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: Wed, 04 Aug 2021 17:04:21 +0200
In-Reply-To: <87fswo8goa.fsf@HIDDEN> (Kyle Meyer's message of "Thu, 08 Jul
 2021 20:38:45 -0400")
Message-ID: <87h7g5p7yi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Kyle,

Kyle Meyer <kyle@HIDDEN> skribis:

> Ludovic Court=C3=A8s writes:
>
>> For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7 by Kyle
>> (Cc=E2=80=99d) gives the ability to use the remote HEAD by default, whic=
h 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---
>>
>> =E2=80=A6 but it works for <https://github.com/guix-mirror/guix>.
>>
>> Presumably we have a server-side setup issue at Savannah?
>
> Hmm, it looks like it's there:
>
>   $ git ls-remote https://git.savannah.gnu.org/git/guix.git | grep HEAD
>   e499500730de23fd54ae63696a725d4b90a406d7	HEAD
>
>   $ git clone https://git.savannah.gnu.org/git/guix.git && cd guix
>   $ git for-each-ref refs/remotes/origin | grep HEAD
>   e499500730de23fd54ae63696a725d4b90a406d7 commit	refs/remotes/origin/HEAD
>   $ git name-rev refs/remotes/origin/HEAD
>   refs/remotes/origin/HEAD master

OK, so something else must be at fault.

Ideas?

> This might be a long shot, but if you cloned the repo with magit-clone,
> it has some custom logic that deletes refs/remotes/<remote>/HEAD unless
> magit-clone-set-remote-head is non-nil (and it's nil by default).

No, these are clones managed via (guix git) only.

>> Are there downsides, or cases where it might pick the wrong branch?
>
> The main downside I can think of is what I mentioned in bug#45187
> (87v9d8dk0r.fsf@HIDDEN):
>
>   [The remote HEAD symref] probably the best indicator of what the
>   primary branch is.  In a clone, it doesn't necessarily match HEAD on
>   the remote, because users may change it to another branch they're
>   interested in, but that isn't really relevant to these
>   behind-the-scenes checkouts.
>
> So, if it's a user-facing clone, refs/remotes/origin/HEAD isn't a
> reliable indicator because users are free to redirect the remote HEAD
> symref to another branch of interest [*] or to delete it altogether.
>
> I think channel clones would fall into the "behind the scenes" category,
> though, right?

Right, those cached clones managed by (guix git) are behind the scenes;
we can assume only (guix git) will only ever touch them.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at 49252 <at> debbugs.gnu.org:


Received: (at 49252) by debbugs.gnu.org; 9 Jul 2021 00:38:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 08 20:38:54 2021
Received: from localhost ([127.0.0.1]:57898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m1eXd-00047M-SK
	for submit <at> debbugs.gnu.org; Thu, 08 Jul 2021 20:38:54 -0400
Received: from out2.migadu.com ([188.165.223.204]:12766)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kyle@HIDDEN>) id 1m1eXa-00047A-2c
 for 49252 <at> debbugs.gnu.org; Thu, 08 Jul 2021 20:38:52 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1;
 t=1625791128;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=TgcRn5+/bkHbfvnbGeIgDlquYPvEWMtbwGx5JF8YhSs=;
 b=dxFflbhf97NCb1R8m23sN4dx2450qWPl6E6kI+B7Emc5YKIF2t/SxlQToXGzrOsoZrpX9J
 x/VIWKml27gLvnCJcK3nqtLHNhiJvuwkb/kbNq7UlKHwnxJuz7q9hM0HVU12fMm+gCrGzO
 tpG/4N9ym5yIEj9WbnfpzkRi/K1YP805RU6MJNEyHrNp85YVIIZJGtyHBqBaiyD083QkKe
 Cevk6Pvb0ZbRv6+xrHavuJXXdwvdA5P7Yp02qSNl8Yp46OdyLZLUPKdMG6bQs7s/kKkf4z
 yi5yno6C7C9sbofrG5wk0qBfMJ6Slx1LXKav8TkLC26u9+YV7Og9xarY2OxTxA==
From: Kyle Meyer <kyle@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#49252] [PATCH] Channels defaulting to HEAD instead of
 =?utf-8?B?4oCYbWFzdGVy4oCZ?=
In-Reply-To: <87y2auw3jo.fsf@HIDDEN>
References: <87y2auw3jo.fsf@HIDDEN>
Date: Thu, 08 Jul 2021 20:38:45 -0400
Message-ID: <87fswo8goa.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: kyle@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49252
Cc: Ricardo Wurmus <rekado@HIDDEN>, 49252 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Ludovic Court=C3=A8s writes:

> For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7 by Kyle
> (Cc=E2=80=99d) 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---
>
> =E2=80=A6 but it works for <https://github.com/guix-mirror/guix>.
>
> Presumably we have a server-side setup issue at Savannah?

Hmm, it looks like it's there:

  $ git ls-remote https://git.savannah.gnu.org/git/guix.git | grep HEAD
  e499500730de23fd54ae63696a725d4b90a406d7	HEAD

  $ git clone https://git.savannah.gnu.org/git/guix.git && cd guix
  $ git for-each-ref refs/remotes/origin | grep HEAD
  e499500730de23fd54ae63696a725d4b90a406d7 commit	refs/remotes/origin/HEAD
  $ git name-rev refs/remotes/origin/HEAD
  refs/remotes/origin/HEAD master

This might be a long shot, but if you cloned the repo with magit-clone,
it has some custom logic that deletes refs/remotes/<remote>/HEAD unless
magit-clone-set-remote-head is non-nil (and it's nil by default).

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

The main downside I can think of is what I mentioned in bug#45187
(87v9d8dk0r.fsf@HIDDEN):

  [The remote HEAD symref] probably the best indicator of what the
  primary branch is.  In a clone, it doesn't necessarily match HEAD on
  the remote, because users may change it to another branch they're
  interested in, but that isn't really relevant to these
  behind-the-scenes checkouts.

So, if it's a user-facing clone, refs/remotes/origin/HEAD isn't a
reliable indicator because users are free to redirect the remote HEAD
symref to another branch of interest [*] or to delete it altogether.

I think channel clones would fall into the "behind the scenes" category,
though, right?


[*] This is discussed here:
    https://lore.kernel.org/git/xmqqlfivwvtw.fsf@HIDDEN/




Information forwarded to guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Jun 2021 12:56:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 28 08:56:51 2021
Received: from localhost ([127.0.0.1]:51260 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lxqol-0006K9-9K
	for submit <at> 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 <ludo@HIDDEN>) id 1lxqoh-0006Jx-SX
 for submit <at> 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 <ludo@HIDDEN>) id 1lxqoh-0000Z7-Hu
 for guix-patches@HIDDEN; 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 <ludo@HIDDEN>) id 1lxqoh-0003Gj-Ar
 for guix-patches@HIDDEN; 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 <ludo@HIDDEN>) id 1lxqog-0004lY-77
 for guix-patches@HIDDEN; Mon, 28 Jun 2021 08:56:46 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] Channels defaulting to HEAD instead of =?utf-8?B?4oCYbWFz?=
 =?utf-8?B?dGVy4oCZ?=
X-Debbugs-Cc: Ricardo Wurmus <rekado@HIDDEN>, Kyle Meyer <kyle@HIDDEN>
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@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

With an eye on allowing channel authors, and Guix in particular, to
eventually be able to choose a default branch name other than =E2=80=98mast=
er=E2=80=99,
what about changing defaults like this:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

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

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7 by Kyle
(Cc=E2=80=99d) 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' n=
ot found
--8<---------------cut here---------------end--------------->8---

=E2=80=A6 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=E2=80=99.

--=-=-=--




Acknowledgement sent to Ludovic Courtès <ludo@HIDDEN>:
New bug report received and forwarded. Copy sent to rekado@HIDDEN, kyle@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to rekado@HIDDEN, kyle@HIDDEN, guix-patches@HIDDEN:
bug#49252; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 7 Jan 2026 14:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.