GNU bug report logs - #30428
guix git-fetch doesn't specify "--depth 1" - git clone clones a lot without any use

Previous Next

Package: guix;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Mon, 12 Feb 2018 00:18:02 UTC

Severity: normal

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Leo Famulari <leo <at> famulari.name>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 30428 <at> debbugs.gnu.org
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
[Message part 1 (text/plain, inline)]
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 <dannym <at> scratchpost.org> wrote:
>Hi Leo,
>
>On Mon, 12 Feb 2018 10:09:39 -0500
>Leo Famulari <leo <at> famulari.name> 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.
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.