mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
git-download: Fetch only the required commit, if possible.
* guix/build/git.scm (git-fetch): Fetch only the required commit, if possible.
This commit is contained in:
parent
48c8622010
commit
329dabe13b
1 changed files with 23 additions and 20 deletions
|
@ -37,13 +37,16 @@ (define* (git-fetch url commit directory
|
||||||
;; in advance anyway.
|
;; in advance anyway.
|
||||||
(setenv "GIT_SSL_NO_VERIFY" "true")
|
(setenv "GIT_SSL_NO_VERIFY" "true")
|
||||||
|
|
||||||
;; We cannot use "git clone --recursive" since the following "git checkout"
|
(mkdir-p directory)
|
||||||
;; effectively removes sub-module checkouts as of Git 2.6.3.
|
|
||||||
(and (zero? (system* git-command "clone" url directory))
|
|
||||||
(with-directory-excursion directory
|
(with-directory-excursion directory
|
||||||
(system* git-command "tag" "-l")
|
(invoke git-command "init")
|
||||||
(and (zero? (system* git-command "checkout" commit))
|
(invoke git-command "remote" "add" "origin" url)
|
||||||
|
(if (zero? (system* git-command "fetch" "--depth" "1" "origin" commit))
|
||||||
|
(invoke git-command "checkout" "FETCH_HEAD")
|
||||||
(begin
|
(begin
|
||||||
|
(invoke git-command "fetch" "origin")
|
||||||
|
(invoke git-command "checkout" commit)))
|
||||||
(when recursive?
|
(when recursive?
|
||||||
;; Now is the time to fetch sub-modules.
|
;; Now is the time to fetch sub-modules.
|
||||||
(unless (zero? (system* git-command "submodule" "update"
|
(unless (zero? (system* git-command "submodule" "update"
|
||||||
|
@ -59,6 +62,6 @@ (define* (git-fetch url commit directory
|
||||||
;; status of the Git repo. Since we want a fixed output, this
|
;; status of the Git repo. Since we want a fixed output, this
|
||||||
;; directory needs to be taken out.
|
;; directory needs to be taken out.
|
||||||
(delete-file-recursively ".git")
|
(delete-file-recursively ".git")
|
||||||
#t)))))
|
#t))
|
||||||
|
|
||||||
;;; git.scm ends here
|
;;; git.scm ends here
|
||||||
|
|
Loading…
Reference in a new issue