[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’
From: |
Ludovic Courtès |
Subject: |
[bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’ |
Date: |
Tue, 10 Aug 2021 10:04:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
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’.