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

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 28 Jun 2021 12:57:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Kyle Meyer <kyle <at> kyleam.com>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 49252 <at> debbugs.gnu.org
Subject: [bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’
Date: Mon, 09 Aug 2021 11:12:08 +0200
Hello Kyle,

Kyle Meyer <kyle <at> kyleam.com> skribis:

> Ludovic Courtès writes:
>
>> Kyle Meyer <kyle <at> kyleam.com> 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/HEAD
>>>   $ 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/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq

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 = "/home/ludo/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq"
$3 = "30289f4d4638452520f52c1a36240220d0d940ff"
$4 = #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/ImmuneDynamics/Spectre")
$5 = "/home/ludo/.cache/guix/checkouts/lpz4iyuu3pztx73ks74bfiymewyzn24rm565l6cgiutvjow5joka"
$6 = "742ebc4bc09ce69b970eceb78291bdbf5229d20d"
$7 = #f
--8<---------------cut here---------------end--------------->8---

I suppose we need to add a call to fetch remote heads when they’re
missing?  It seems that calling ‘remote-fetch’ is not enough.  If I
explicitly remove ‘HEAD’ from the clone, then I get:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define r (repository-open "/home/ludo/.cache/guix/checkouts/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 ‘remote-ls’ doesn’t populate that file either:

--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 = (#<<remote-head> local: 0 oid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> loid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> name: "HEAD" symref-target: 73408368> #<<remote-head> local: 0 oid: #<oid 00000000c9d6e28e5d48c056ee6ad36cc4ab0861> loid: #<oid 00000000c9d6e28e5d48c056ee6ad36cc4ab0861> 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 00000000e6985cce0e75b63dab3032ae875f5592> loid: #<oid 00000000e6985cce0e75b63dab3032ae875f5592> name: "refs/heads/pre-release" symref-target: 0> […])
--8<---------------cut here---------------end--------------->8---

So I’m not sure what the best approach is.  Thoughts?

Ludo’.




This bug report was last modified 3 years and 307 days ago.

Previous Next


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