Subject: [bug#65352] Fix time-machine and network

From: Simon Tournier <[email-masked]>
Date: Tue, 05 Sep 2023 22:56:11 +0200

Hi Maxim,

On Tue, 05 Sep 2023 at 16:39, Maxim Cournoyer <[email-masked]> wrote:

> I've reviewed this thread and the code, and I agree.  This is a special
> case.  I've added a comment so we aren't tempted to use
> 'resolve-reference' there again.

I disagree.  There is no special case.  The culprit is the procedure
’validate-guix-channel’ as explained in:

        [bug#65352] Fix time-machine and network
        Simon Tournier <[email-masked]>
        Mon, 04 Sep 2023 19:37:08 +0200
        id:[email-masked]
        https://issues.guix.gnu.org//65352
        https://issues.guix.gnu.org/msgid/[email-masked]
        https://yhetil.org/guix/[email-masked]

> Will install shortly.

I do not know what you will install shortly.  The fix belong to
validate-guix-channel, something like:

         (let* ((guix-channel (find guix-channel? channels))
                (reference (or ref
                               (match (channel-commit guix-channel)
                                 (#f `(branch . ,(channel-branch guix-channel)))
                                 (commit `(tag-or-commit . ,commit)))))
                (checkout commit relation (update-cached-checkout
                                           (channel-url guix-channel)
                                           #:ref reference
                                           #:starting-commit
                                           %oldest-possible-commit)))

and that would avoid to break the “contract” of resolve-reference.
Before committing something, I was testing.

Cheers,
simon