aboutsummaryrefslogtreecommitdiff
path: root/guix/forge/build
diff options
context:
space:
mode:
Diffstat (limited to 'guix/forge/build')
-rw-r--r--guix/forge/build/git.scm30
1 files changed, 19 insertions, 11 deletions
diff --git a/guix/forge/build/git.scm b/guix/forge/build/git.scm
index 1434d07..098be83 100644
--- a/guix/forge/build/git.scm
+++ b/guix/forge/build/git.scm
@@ -40,10 +40,14 @@
(newline)
(force-output))
-(define* (download-git-to-store store name url #:key branch show-commit?)
+(define* (download-git-to-store store name url #:key branch show-commit? deep-clone?)
"Download BRANCH of git repository from URL to STORE under NAME and
return store path. If BRANCH is not specified, the default branch is
-downloaded. git and certificates should be in the environment."
+downloaded. git and certificates should be in the environment.
+
+If DEEP-CLONE? is #t, the git repository is deep cloned and the .git
+directory is included in the store. Else, the git repository is
+shallow cloned and the .git directory is not included."
(call-with-temporary-directory
(lambda (directory)
(with-directory-excursion directory
@@ -55,21 +59,25 @@ downloaded. git and certificates should be in the environment."
(invoke-error-exit-status condition))
(exit #f)))
(apply invoke
- "git" "clone" "--quiet" "--depth" "1"
- ;; Append file:// to local repository path so that
- ;; shallow clone works.
- (if (string-prefix? "/" url)
- (string-append "file://" url)
- url)
- (append (if branch
+ "git" "clone" "--quiet"
+ (append (if deep-clone?
+ (list)
+ (list "--depth" "1"))
+ ;; Append file:// to local repository path so
+ ;; that shallow clone works.
+ (list (if (string-prefix? "/" url)
+ (string-append "file://" url)
+ url))
+ (if branch
(list "--branch" branch)
(list))
(list "."))))
(when show-commit?
(hline)
- (invoke "git" "--no-pager" "log")
+ (invoke "git" "log" "HEAD~1..HEAD")
(hline))
- (delete-file-recursively ".git"))
+ (unless deep-clone?
+ (delete-file-recursively ".git")))
(add-to-store store name #t "sha256" directory))))
(define latest-git-checkout