(zilch lang rust registry): skip git fetch if revspec already fetched

This commit is contained in:
puck 2025-03-02 14:10:06 +00:00
parent 493f6712de
commit 5721c8263b

View file

@ -127,7 +127,9 @@
(create-directory repo #t) (create-directory repo #t)
(let-values (((_ _ _) (process-wait (process-run "git" (list "init" "--bare" repo))))) #f)) (let-values (((_ _ _) (process-wait (process-run "git" (list "init" "--bare" repo))))) #f))
(define-values (_ _ _) (process-wait (process-run "git" (list "-C" repo "fetch" "--write-fetch-head" url refspec)))) (define-values (_ commit-exists _) (process-wait (process-run "git" (list "-C" repo "cat-file" "-e" refspec))))
(unless commit-exists
(let-values (((_ _ _) (process-wait (process-run "git" (list "-C" repo "fetch" "--write-fetch-head" url refspec))))) #f))
(define tree (read-git-tree repo (string-append refspec ":"))) (define tree (read-git-tree repo (string-append refspec ":")))
(define subdir (find-matching-cargo tree name)) (define subdir (find-matching-cargo tree name))
(unless subdir (error "could not find package in git repo" (list url refspec name))) (unless subdir (error "could not find package in git repo" (list url refspec name)))