unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 65352@debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#65352] Fix time-machine and network
Date: Wed, 13 Sep 2023 02:32:17 +0200	[thread overview]
Message-ID: <86a5tqzze6.fsf@gmail.com> (raw)
In-Reply-To: <875y4dltgm.fsf_-_@gnu.org>

Hi Ludo,

On Wed, 13 Sep 2023 at 22:16, Ludovic Courtès <ludo@gnu.org> wrote:

>> +    (('commit . (? commit-id? commit))
>> +     (let ((oid (string->oid commit)))
>> +       (->bool (commit-lookup repository oid))))
>> +    ((or ('tag . str)
>> +         ('tag-or-commit . str))
>> +     (false-if-git-not-found
>> +      (->bool (resolve-reference repository ref))))
>
> IIUC, the differences compared to what we had are:
>
>   1. 'tag references are now handled on the fast path
>      (‘reference-available?’ can return #t);
>
>   2. short commit strings are now always on the slow path
>      (‘reference-available?’ always returns #f).
>
> Is that correct?

No, or I am missing some details.

> It would be nice to have #1 without #2.

It’s already the case because of that:

         (option '("commit") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'ref `(tag-or-commit . ,arg) result)))

Currently, the heuristic to determine if it is a tag or a commit is
implemented by ’resolve-reference’.

Somehow, considering the command-line parser, the alternative is:

    #1 and #2 on the fast path (the patch)
 or
    #1 and #2 on the slow path (the current implementation)

Let ’pk’ (see below) to convince you. :-)

Before the proposed patch:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix time-machine --commit=v1.4.0 -- describe

;;; (ref (tag-or-commit . "v1.4.0"))

;;; (reference-available? #f)

;;; (remote-fetch NETWORK)
  C-c C-c

$ ./pre-inst-env guix time-machine --commit=8e2f32c -- describe

;;; (ref (tag-or-commit . "8e2f32c"))

;;; (reference-available? #f)

;;; (remote-fetch NETWORK)
  C-c C-c
--8<---------------cut here---------------end--------------->8---

After the proposed patch:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix time-machine --commit=v1.4.0 -- describe

;;; (ref (tag-or-commit . "v1.4.0"))

;;; (reference-available? #t)
  guix 8e2f32c
    repository URL: https://git.savannah.gnu.org/git/guix.git
    commit: 8e2f32cee982d42a79e53fc1e9aa7b8ff0514714

$ ./pre-inst-env guix time-machine --commit=8e2f32c -- describe

;;; (ref (tag-or-commit . "8e2f32c"))

;;; (reference-available? #t)
  guix 8e2f32c
    repository URL: https://git.savannah.gnu.org/git/guix.git
    commit: 8e2f32cee982d42a79e53fc1e9aa7b8ff0514714
--8<---------------cut here---------------end--------------->8---


Cheers,
simon

--8<---------------cut here---------------start------------->8---
diff --git a/guix/git.scm b/guix/git.scm
index 1cb87a45607b..c927555cce18 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -481,6 +481,8 @@ (define* (update-cached-checkout url
                              (repository-open cache-directory)
                              (clone/swh-fallback url ref cache-directory))))
      ;; Only fetch remote if it has not been cloned just before.
+     (pk 'ref ref)
+     (pk 'reference-available? (reference-available? repository ref))
      (when (and cache-exists?
                 (not (reference-available? repository ref)))
        (remote-fetch (remote-lookup repository "origin")
--8<---------------cut here---------------end--------------->8---




  reply	other threads:[~2023-09-13 22:53 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1689823648.git.maxim.cournoyer@gmail.com>
2023-07-20 16:34 ` [bug#64746] [PATCH 2/2] scripts: time-machine: Error when attempting to visit too old commits Maxim Cournoyer
2023-07-22  2:00   ` Maxim Cournoyer
2023-08-08 15:58     ` Ludovic Courtès
2023-08-10 14:47       ` Maxim Cournoyer
2023-08-10 16:56         ` Ludovic Courtès
2023-08-11  7:19           ` Josselin Poiret via Guix-patches via
2023-08-12 20:32             ` Ludovic Courtès
2023-08-15 18:57       ` Maxim Cournoyer
2023-08-15 16:14   ` Ludovic Courtès
2023-08-16 14:46     ` Simon Tournier
2023-08-16 18:41       ` Maxim Cournoyer
2023-08-17 14:06         ` [bug#65352] Fix time-machine and network Simon Tournier
2023-08-17 14:09           ` [bug#65352] [PATCH 1/2] guix: git: Fix the procedure reference-available? Simon Tournier
2023-08-17 14:09             ` [bug#65352] [PATCH 2/2] scripts: pull: Remove unused reference pair Simon Tournier
2023-08-17 15:41               ` [bug#65352] Fix time-machine and network Maxim Cournoyer
2023-08-17 16:08                 ` Simon Tournier
2023-08-23  2:56                   ` Maxim Cournoyer
2023-08-23  8:32                     ` Simon Tournier
2023-08-23 20:25                       ` Maxim Cournoyer
2023-08-21 14:00                 ` Ludovic Courtès
2023-08-21 15:58                   ` Maxim Cournoyer
2023-08-22 16:27                     ` Ludovic Courtès
2023-08-23  2:14                       ` Maxim Cournoyer
2023-08-21 13:57             ` Ludovic Courtès
2023-09-04  8:49             ` Ludovic Courtès
2023-09-04 11:34               ` Simon Tournier
2023-09-05 20:33                 ` Maxim Cournoyer
2023-09-05 20:48                   ` Simon Tournier
2023-09-04  9:32             ` Ludovic Courtès
2023-09-04 17:37               ` Simon Tournier
2023-09-06  0:22                 ` Maxim Cournoyer
2023-09-05 20:39               ` Maxim Cournoyer
2023-09-05 20:56                 ` Simon Tournier
2023-09-06  2:39                   ` Maxim Cournoyer
2023-09-05 13:24             ` bug#65352: " Maxim Cournoyer
2023-09-05 13:43               ` [bug#65352] " Simon Tournier
2023-09-06  0:04                 ` bug#65352: " Maxim Cournoyer
2023-09-06  0:58                   ` [bug#65352] " Simon Tournier
2023-09-06  2:00                     ` Maxim Cournoyer
2023-09-07 11:15                       ` Simon Tournier
2023-09-06 10:32           ` [bug#65352] time-machine, unavailable network or Savannah down Simon Tournier
2023-09-06 14:17             ` [bug#65352] [PATCH v2] DRAFT git: Avoid touching the network unless needed in 'reference-available?' Simon Tournier
2023-09-13 20:16               ` [bug#65352] Fix time-machine and network Ludovic Courtès
2023-09-13  0:32                 ` Simon Tournier [this message]
2023-09-14  8:50                   ` Ludovic Courtès
2023-09-14  9:04                   ` Ludovic Courtès
2023-09-14  9:42                     ` Simon Tournier
2023-09-22 13:54                       ` bug#65352: " Simon Tournier
2023-09-25  9:32                     ` [bug#65352] " Ludovic Courtès
2023-09-25  9:57                       ` Simon Tournier
2023-09-25 11:21                         ` Simon Tournier
2023-09-25 15:01                         ` Ludovic Courtès
2023-09-25 15:58                           ` Simon Tournier
2023-09-06 17:41             ` [bug#65352] time-machine, unavailable network or Savannah down Maxim Cournoyer
2023-09-06 23:21               ` Simon Tournier
2023-08-15 19:44   ` [bug#64746] [PATCH v2 1/3] git: Clarify commit relation reference in doc Maxim Cournoyer
2023-08-15 19:44     ` [bug#64746] [PATCH v2 2/3] pull: Tag commit argument with 'tag-or-commit Maxim Cournoyer
2023-08-16 15:02       ` Simon Tournier
2023-08-16 18:47         ` Maxim Cournoyer
2023-08-17 14:45           ` Simon Tournier
2023-08-17 18:16             ` Maxim Cournoyer
2023-08-17 18:47               ` Simon Tournier
2023-08-23  2:54                 ` [bug#64746] [PATCH 2/2] scripts: time-machine: Error when attempting to visit too old commits Maxim Cournoyer
2023-08-23  8:27                   ` Simon Tournier
2023-08-15 19:44     ` [bug#64746] [PATCH v2 3/3] " Maxim Cournoyer
2023-08-16 15:39       ` Simon Tournier
2023-08-17  1:41         ` bug#64746: " Maxim Cournoyer

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=86a5tqzze6.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=65352@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /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).