[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#65352] Fix time-machine and network
From: |
Simon Tournier |
Subject: |
[bug#65352] Fix time-machine and network |
Date: |
Wed, 13 Sep 2023 02:32:17 +0200 |
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---
- [bug#65352] time-machine, unavailable network or Savannah down, Simon Tournier, 2023/09/06
- [bug#65352] [PATCH v2] DRAFT git: Avoid touching the network unless needed in 'reference-available?'., Simon Tournier, 2023/09/06
- [bug#65352] Fix time-machine and network, Ludovic Courtès, 2023/09/13
- [bug#65352] Fix time-machine and network, Ludovic Courtès, 2023/09/25
- [bug#65352] Fix time-machine and network, Simon Tournier, 2023/09/25
- [bug#65352] Fix time-machine and network, Simon Tournier, 2023/09/25
- [bug#65352] Fix time-machine and network, Ludovic Courtès, 2023/09/25
- [bug#65352] Fix time-machine and network, Simon Tournier, 2023/09/25
[bug#65352] time-machine, unavailable network or Savannah down, Maxim Cournoyer, 2023/09/06