guix: git: Avoid touching the network unless needed in 'reference-available?'.
* guix/git/scm (reference-available?): Use the resolve-reference procedure to determine whether the reference exists in the local Git checkout. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
790e5bf0c5
commit
a789dd5865
13
guix/git.scm
13
guix/git.scm
@ -360,17 +360,8 @@ dynamic extent of EXP."
|
|||||||
(define (reference-available? repository ref)
|
(define (reference-available? repository ref)
|
||||||
"Return true if REF, a reference such as '(commit . \"cabba9e\"), is
|
"Return true if REF, a reference such as '(commit . \"cabba9e\"), is
|
||||||
definitely available in REPOSITORY, false otherwise."
|
definitely available in REPOSITORY, false otherwise."
|
||||||
(match ref
|
(false-if-git-not-found
|
||||||
((or ('commit . commit)
|
(->bool (resolve-reference repository ref))))
|
||||||
('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)
|
(define (clone-from-swh url tag-or-commit output)
|
||||||
"Attempt to clone TAG-OR-COMMIT (a string), which originates from URL, using
|
"Attempt to clone TAG-OR-COMMIT (a string), which originates from URL, using
|
||||||
|
Loading…
Reference in New Issue
Block a user