diff options
author | Simon Tournier <zimon.toutoune@gmail.com> | 2023-08-17 16:09:16 +0200 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-09-17 16:24:02 -0400 |
commit | 62e66ecefa438d3c56fa77ce75dc9bcc8c56c785 (patch) | |
tree | 5dfe01a1b97279ae32df921ccd903129d356f342 /guix/git.scm | |
parent | fdef9860f845e885e62dfd1d55a8e9e13ba25704 (diff) |
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>
Diffstat (limited to 'guix/git.scm')
-rw-r--r-- | guix/git.scm | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/guix/git.scm b/guix/git.scm index dbc3b7caa7..ebe2600209 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -360,17 +360,8 @@ 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." - (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))) + (false-if-git-not-found + (->bool (resolve-reference repository ref)))) (define (clone-from-swh url tag-or-commit output) "Attempt to clone TAG-OR-COMMIT (a string), which originates from URL, using |