From: "Ludovic Courtès" <ludo@gnu.org>
To: Kyle Meyer <kyle@kyleam.com>
Cc: Ricardo Wurmus <rekado@elephly.net>, 49252@debbugs.gnu.org
Subject: [bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’
Date: Tue, 10 Aug 2021 10:04:22 +0200 [thread overview]
Message-ID: <87r1f1sp2x.fsf@gnu.org> (raw)
In-Reply-To: <87h7fyhwwj.fsf@kyleam.com> (Kyle Meyer's message of "Mon, 09 Aug 2021 22:10:52 -0400")
Kyle Meyer <kyle@kyleam.com> skribis:
> Ludovic Courtès writes:
>
>> Oh, this must be the reason. If I remove the cached clone:
>>
>> rm -rf ~/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq
>>
>> 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’re
>> missing? It seems that calling ‘remote-fetch’ is not enough.
>
> 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 = (#<<remote-head> local: 0 oid: #<oid 00000000742ebc4bc09ce69b970eceb78291bdbf> 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 “by hand”? The
advantage is that we wouldn’t have to wait for the new Guile-Git
release; but OTOH, we’re the ones making the Guile-Git release, too…
Thanks,
Ludo’.
next prev parent reply other threads:[~2021-08-10 8:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-08-11 0:34 ` Kyle Meyer
2021-08-08 13:53 ` Ricardo Wurmus
2021-08-08 23:08 ` Kyle Meyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1f1sp2x.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=49252@debbugs.gnu.org \
--cc=kyle@kyleam.com \
--cc=rekado@elephly.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).