Subject: [bug#53144] [PATCH 0/13] Make more git-using packages auto-updatable

From: Ludovic Courtès <[email-masked]>
Date: Tue, 18 Jan 2022 18:39:39 +0100

Maxime Devos <[email-masked]> skribis:

> * guix/git.scm (remote-refs): Split off some logic to ...
>   (call-with-detached-remote): ... this new procedure.
>   (lookup-reference): New procedure.
> * tests/git.scm ("lookup-reference: branch and HEAD"): New test.

[...]

> +;; TODO: it would be nice to use 'remote-create-detached' here,
> +;; but that procedure isn't in any released version of guile-git yet.
> +(define (call-with-detached-remote url proc)

Let’s prepare a new Guile-Git release then (Erik Edrosa has been MIA
lately, but Marius, Mathieu, or myself can tag a release when needed).

> +  "Call PROC with a remote for URL.  The remote is closed after PROC returns."
> +  (call-with-temporary-directory
> +   (lambda (cache-directory)
> +     (let* ((repository (repository-init cache-directory))
> +            ;; Create an in-memory remote so we don't touch disk.
> +            (remote (remote-create-anonymous repository url)))
> +       (remote-connect remote)
> +       (let-values ((result (proc remote)))

s/let-values/let/

> +         ;; Wait until we're finished with the repository before closing it.
> +         (remote-disconnect remote)
> +         (repository-close! repository)
> +         (apply values result))))))

We can use this code until Guile-Git provides ‘remote-create-detached’
though.

Otherwise LGTM!

Ludo’.