mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
import: utils: Add git-repository-url? procedure.
* guix/import/utils.scm (git-repository-url?): Add procedure. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
committed by
Ludovic Courtès
parent
6aaed933bf
commit
0533284354
@@ -74,6 +74,7 @@
|
|||||||
peekable-lambda
|
peekable-lambda
|
||||||
peek-body
|
peek-body
|
||||||
|
|
||||||
|
git-repository-url?
|
||||||
download-git-repository
|
download-git-repository
|
||||||
git-origin
|
git-origin
|
||||||
git->origin
|
git->origin
|
||||||
@@ -187,6 +188,19 @@ thrown."
|
|||||||
(define (peek-body proc)
|
(define (peek-body proc)
|
||||||
(procedure-property proc 'body))
|
(procedure-property proc 'body))
|
||||||
|
|
||||||
|
(define (git-repository-url? url)
|
||||||
|
"Guess if the URL looks like a Git repository."
|
||||||
|
(or (string-prefix? "https://github.com/" url) ; Most common.
|
||||||
|
(string-prefix? "https://cgit." url)
|
||||||
|
(string-prefix? "https://git." url)
|
||||||
|
(string-prefix? "https://gitlab." url)
|
||||||
|
(string-prefix? "https://codeberg.org/" url)
|
||||||
|
(string-prefix? "https://git.sr.ht/" url)
|
||||||
|
(string-prefix? "https://bitbucket.org/" url)
|
||||||
|
(string-prefix? "https://framagit.org/" url)
|
||||||
|
;; Fallback.
|
||||||
|
(string-suffix? ".git" url)))
|
||||||
|
|
||||||
(define (download-git-repository url ref)
|
(define (download-git-repository url ref)
|
||||||
"Fetch the given REF from the Git repository at URL. Return three values :
|
"Fetch the given REF from the Git repository at URL. Return three values :
|
||||||
the commit hash, the downloaded directory and its content hash."
|
the commit hash, the downloaded directory and its content hash."
|
||||||
|
|||||||
Reference in New Issue
Block a user