[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/08: git-download: Correctly implement recursive checkouts.
From: |
Ludovic Courtès |
Subject: |
01/08: git-download: Correctly implement recursive checkouts. |
Date: |
Mon, 04 Jan 2016 23:28:58 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 35a6dabcf1386fa33539a4d022dc3a46b536de64
Author: Ludovic Courtès <address@hidden>
Date: Mon Jan 4 22:10:03 2016 +0100
git-download: Correctly implement recursive checkouts.
Previously, the 'git checkout' invocation would remove sub-modules that
had been initialized by 'git clone --recursive'.
* guix/build/git.scm (git-fetch): Never use "git clone --recursive".
Invoke "git submodule update --init --recursive" after "git checkout".
Remove '.git' directories as the last step.
---
guix/build/git.scm | 43 ++++++++++++++++++++++++-------------------
1 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/guix/build/git.scm b/guix/build/git.scm
index 121f07a..c1af545 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 <address@hidden>
+;;; Copyright © 2014, 2016 Ludovic Courtès <address@hidden>
;;;
;;; 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
- branch master updated (4828ff9 -> 1075b43), Ludovic Courtès, 2016/01/04
- 02/08: ui: Update copyright year in '--version' output., Ludovic Courtès, 2016/01/04
- 04/08: services: boot: Reinstate /tmp and /var/run deletion., Ludovic Courtès, 2016/01/04
- 03/08: guix package: Allow multiple '--search' flags., Ludovic Courtès, 2016/01/04
- 01/08: git-download: Correctly implement recursive checkouts.,
Ludovic Courtès <=
- 05/08: services: Move /tmp cleanup to a separate service., Ludovic Courtès, 2016/01/04
- 06/08: linux-boot: Remove verbose output for module loads., Ludovic Courtès, 2016/01/04
- 07/08: gnu: emacs: Remove 'info.info'., Ludovic Courtès, 2016/01/04
- 08/08: gnu: Add emacs-undo-tree., Ludovic Courtès, 2016/01/04