[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
39/40: Revert "guix: git: Avoid touching the network unless needed in 'r
From: |
guix-commits |
Subject: |
39/40: Revert "guix: git: Avoid touching the network unless needed in 'reference-available?'." |
Date: |
Tue, 5 Sep 2023 20:02:24 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository guix.
commit 756e336fa008c2469b4a7317ad5c641ed48f25d6
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Tue Sep 5 16:30:22 2023 -0400
Revert "guix: git: Avoid touching the network unless needed in
'reference-available?'."
This reverts commit a789dd58656d5f7f1b8edf790d77753fc71670af, which broke
e.g.:
guix time-machine -C <(echo %default-channels) -- describe
Add an explanatory comment as suggested.
Reported-by: Ludovic Courtès <ludo@gnu.org>
---
guix/git.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/guix/git.scm b/guix/git.scm
index ebe2600209..a957773873 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -360,8 +360,22 @@ dynamic extent of EXP."
(define (reference-available? repository ref)
"Return true if REF, a reference such as '(commit . \"cabba9e\"), is
definitely available in REPOSITORY, false otherwise."
- (false-if-git-not-found
- (->bool (resolve-reference repository ref))))
+ ;; Note: this must not rely on 'resolve-reference', as that procedure always
+ ;; resolves the references for branch names such as master. The semantic we
+ ;; want here is that unless the reference is exact (e.g. a commit), the
+ ;; reference should not be considered available, has it could have changed
+ ;; on the remote.
+ (match ref
+ ((or ('commit . commit)
+ ('tag-or-commit . (? commit-id? commit)))
+ (let ((len (string-length commit))
+ (oid (string->oid commit)))
+ (false-if-git-not-found
+ (->bool (if (< len 40)
+ (object-lookup-prefix repository oid len OBJ-COMMIT)
+ (commit-lookup repository oid))))))
+ (_
+ #f)))
(define (clone-from-swh url tag-or-commit output)
"Attempt to clone TAG-OR-COMMIT (a string), which originates from URL, using
- 01/40: gnu: ungoogled-chromium-wayland: Use gexp., (continued)
- 01/40: gnu: ungoogled-chromium-wayland: Use gexp., guix-commits, 2023/09/05
- 14/40: gnu: sideload: Update to 6.2.1., guix-commits, 2023/09/05
- 06/40: gnu: Add fonts-tlwg., guix-commits, 2023/09/05
- 15/40: gnu: kaidan: Add missing input., guix-commits, 2023/09/05
- 19/40: gnu: simh: Use G-Expressions., guix-commits, 2023/09/05
- 34/40: gnu: ardour: Build locales., guix-commits, 2023/09/05
- 29/40: gnu: arcan: Build all features., guix-commits, 2023/09/05
- 32/40: gnu: arcan: Restyle format., guix-commits, 2023/09/05
- 38/40: gnu: python-skia-pathops: Update to 0.8.0., guix-commits, 2023/09/05
- 18/40: gnu: simh: Update to 3.12-4., guix-commits, 2023/09/05
- 39/40: Revert "guix: git: Avoid touching the network unless needed in 'reference-available?'.",
guix-commits <=
- 27/40: gnu: xarcan: Fix indentation., guix-commits, 2023/09/05
- 36/40: gnu: skia: Update to 110.0.0f3fb7a., guix-commits, 2023/09/05
- 26/40: gnu: xarcan: Update to 0.6.1., guix-commits, 2023/09/05
- 35/40: gnu-maintenance: Do not crash on refresh when origin URI is a list., guix-commits, 2023/09/05
- 28/40: gnu: arcan: Update to 0.6.2.1., guix-commits, 2023/09/05
- 04/40: gnu: dosbox-staging: Update to 0.80.1., guix-commits, 2023/09/05
- 02/40: gnu: mpd: Remove unused imports., guix-commits, 2023/09/05
- 13/40: gnu: pantheon-calculator: Update to 2.0.2., guix-commits, 2023/09/05
- 11/40: gnu: ibus: Add search-path for 'GUIX_GTK3_IM_MODULE_FILE'., guix-commits, 2023/09/05
- 16/40: gnu: kaidan: Update to 0.9.0., guix-commits, 2023/09/05