aboutsummaryrefslogtreecommitdiff
path: root/guix/build/git.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-13 17:50:17 +0100
committerLudovic Courtès <ludo@gnu.org>2016-01-13 18:18:48 +0100
commit8c986ab12034d67db836a881f57c69754d8073ae (patch)
treebf5183011119695ac549d4cfff4dc2175e659397 /guix/build/git.scm
parent203795aceaabec0e0e5818e1650ad407d825d1b3 (diff)
parent7a2eed3aac1ecd0bdf293e33a234fad58f2e5f9e (diff)
downloadgnu-guix-8c986ab12034d67db836a881f57c69754d8073ae.tar
gnu-guix-8c986ab12034d67db836a881f57c69754d8073ae.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build/git.scm')
-rw-r--r--guix/build/git.scm43
1 files changed, 24 insertions, 19 deletions
diff --git a/guix/build/git.scm b/guix/build/git.scm
index 121f07a7fa..c1af545a76 100644
--- a/guix/build/git.scm
+++ b/guix/build/git.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -37,23 +37,28 @@ recursively. Return #t on success, #f otherwise."
;; in advance anyway.
(setenv "GIT_SSL_NO_VERIFY" "true")
- (let ((args `("clone" ,@(if recursive? '("--recursive") '())
- ,url ,directory)))
- (and (zero? (apply system* git-command args))
- (with-directory-excursion directory
- (system* git-command "tag" "-l")
- (and (zero? (system* git-command "checkout" commit))
- (begin
- ;; The contents of '.git' vary as a function of the current
- ;; status of the Git repo. Since we want a fixed output, this
- ;; directory needs to be taken out.
- (delete-file-recursively ".git")
-
- (when recursive?
- ;; In sub-modules, '.git' is a flat file, not a directory,
- ;; so we can use 'find-files' here.
- (for-each delete-file-recursively
- (find-files directory "^\\.git$")))
- #t))))))
+ ;; We cannot use "git clone --recursive" since the following "git checkout"
+ ;; effectively removes sub-module checkouts as of Git 2.6.3.
+ (and (zero? (system* git-command "clone" url directory))
+ (with-directory-excursion directory
+ (system* git-command "tag" "-l")
+ (and (zero? (system* git-command "checkout" commit))
+ (begin
+ (when recursive?
+ ;; Now is the time to fetch sub-modules.
+ (unless (zero? (system* git-command "submodule" "update"
+ "--init" "--recursive"))
+ (error "failed to fetch sub-modules" url))
+
+ ;; In sub-modules, '.git' is a flat file, not a directory,
+ ;; so we can use 'find-files' here.
+ (for-each delete-file-recursively
+ (find-files directory "^\\.git$")))
+
+ ;; The contents of '.git' vary as a function of the current
+ ;; status of the Git repo. Since we want a fixed output, this
+ ;; directory needs to be taken out.
+ (delete-file-recursively ".git")
+ #t)))))
;;; git.scm ends here