aboutsummaryrefslogtreecommitdiff
path: root/guix/git.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-11-21 15:25:57 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-21 23:09:16 +0100
commitfe9b3ec3ee208c5bac7844f3d0fecce2c6b1297d (patch)
treef934d66394478fc7e25c5830ac08babaa03a3a11 /guix/git.scm
parenta6591381fc1f5e1890efb8270a3671062249c2bc (diff)
downloadgnu-guix-fe9b3ec3ee208c5bac7844f3d0fecce2c6b1297d.tar
gnu-guix-fe9b3ec3ee208c5bac7844f3d0fecce2c6b1297d.tar.gz
git: Do not add '.git' to the store.
This makes 'latest-repository-commit' significantly more efficient and reduces disk usage in the store. * guix/git.scm (copy-to-store)[dot-git?]: New procedure. Pass it as the #:select? argument to 'add-to-store'.
Diffstat (limited to 'guix/git.scm')
-rw-r--r--guix/git.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 7a83b56216..fc41e2ace3 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -80,11 +80,17 @@ of SHA1 string."
"-" (string-take sha1 7)))
(define* (copy-to-store store cache-directory #:key url repository)
- "Copy items in cache-directory to store. URL and REPOSITORY are used
-to forge store directory name."
+ "Copy CACHE-DIRECTORY recursively to STORE. URL and REPOSITORY are used to
+create the store directory name."
+ (define (dot-git? file stat)
+ (and (string=? (basename file) ".git")
+ (eq? 'directory (stat:type stat))))
+
(let* ((commit (repository->head-sha1 repository))
(name (url+commit->name url commit)))
- (values (add-to-store store name #t "sha256" cache-directory) commit)))
+ (values (add-to-store store name #t "sha256" cache-directory
+ #:select? (negate dot-git?))
+ commit)))
(define (switch-to-ref repository ref)
"Switch to REPOSITORY's branch, commit or tag specified by REF."