bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30428: guix git-fetch doesn't specify "--depth 1" - git clone clones


From: Leo Famulari
Subject: bug#30428: guix git-fetch doesn't specify "--depth 1" - git clone clones a lot without any use
Date: Mon, 12 Feb 2018 20:28:07 -0500
User-agent: K-9 Mail for Android

I think Google uses JGit for their public facing Git servers, but I'm not sure.

On February 12, 2018 5:59:50 PM EST, Danny Milosavljevic <address@hidden> wrote:
Hi Leo,

On Mon, 12 Feb 2018 10:09:39 -0500
Leo Famulari <address@hidden> wrote:

I think it's worth adding, but as an option, because there are Git
server implementations, like JGit, that don't support shallow cloning.

Thanks for that! I didn't consider that before...

Possible patch (do you know such servers and can test whether they still work?):

diff --git a/guix/build/git.scm b/guix/build/git.scm
index c1af545a7..e54d92be7 100644
--- a/guix/build/git.scm
+++ b/guix/build/git.scm
@@ -37,12 +37,18 @@ recursively. Return #t on success, #f otherwise."
;; in advance anyway.
(setenv "GIT_SSL_NO_VERIFY" "true")

+ (mkdir-p directory)
+
;; 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))
+ (and ;(zero? (system* git-command "clone" url directory))
(with-directory-excursion directory
- (system* git-command "tag" "-l")
- (and (zero? (system* git-command "checkout" commit))
+ ;(system* git-command "tag" "-l")
+ (invoke git-command "init")
+ (invoke git-command "remote" "add" "origin" url)
+ (and (or (zero? (system* git-command "fetch" "--depth" "1" "origin" commit))
+ (zero? (system* git-command "fetch" "origin" commit)))
+ (zero? (system* git-command "checkout" "FETCH_HEAD"))
(begin
(when recursive?
;; Now is the time to fetch sub-modules.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]