Subject: Re: bug#65720: [PATCH] git: Shell out to ‘git gc’ when necessary.

From: Simon Tournier <[email-masked]>
Date: Mon, 23 Oct 2023 12:08:07 +0200

Hi Ludo,

On Fri, 20 Oct 2023 at 18:15, Ludovic Courtès <[email-masked]> wrote:

> * guix/git.scm (packs-in-git-repository, maybe-run-git-gc): New
> procedures.
> (update-cached-checkout): Use it.
> ---
>  guix/git.scm | 39 ++++++++++++++++++++++++++++++++++++---
>  1 file changed, 36 insertions(+), 3 deletions(-)

LGTM.  Just two colors for the bikeshed. :-)

> +  (when (> (packs-in-git-repository directory) 25)

Why 25?  And not 10 or 50 or 100?

>  (define* (update-cached-checkout url
>                                   #:key
>                                   (ref '())
> @@ -515,6 +545,9 @@ (define* (update-cached-checkout url
>                     seconds seconds
>                     nanoseconds nanoseconds))))
>  
> +       ;; Run 'git gc' if needed.
> +       (maybe-run-git-gc cache-directory)

Why not trigger it by “guix gc”?

Well, I expect “guix gc” to take some time and I choose when.  However,
I want “guix pull” or “guix time-machine” to be as fast as possible and
here some extra time is added, and I cannot control exactly when.

Cheers,
simon