From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <7D9604D1-3DAE-4D13-AE73-420E655AC711@famulari.name> References: <20180212011641.3deb7fd6@scratchpost.org> <20180212150939.GA5852@jasmine.lan> <20180212235950.4638aad6@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----IVGZZBH8NY5GWX0U0PG5DDSFS9SCYO" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elPP7-0005Y9-9P for bug-guix@gnu.org; Mon, 12 Feb 2018 20:29:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elPP4-0008JU-Iw for bug-guix@gnu.org; Mon, 12 Feb 2018 20:29:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:60627) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elPP4-0008J8-C4 for bug-guix@gnu.org; Mon, 12 Feb 2018 20:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1elPP3-00045b-Vm for bug-guix@gnu.org; Mon, 12 Feb 2018 20:29:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20180212235950.4638aad6@scratchpost.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: 30428@debbugs.gnu.org ------IVGZZBH8NY5GWX0U0PG5DDSFS9SCYO Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I think Google uses JGit for their public facing Git servers, but I'm not s= ure=2E On February 12, 2018 5:59:50 PM EST, Danny Milosavljevic wrote: >Hi Leo, > >On Mon, 12 Feb 2018 10:09:39 -0500 >Leo Famulari 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=2E > >Thanks for that! I didn't consider that before=2E=2E=2E > >Possible patch (do you know such servers and can test whether they >still work?): > >diff --git a/guix/build/git=2Escm b/guix/build/git=2Escm >index c1af545a7=2E=2Ee54d92be7 100644 >--- a/guix/build/git=2Escm >+++ b/guix/build/git=2Escm >@@ -37,12 +37,18 @@ recursively=2E Return #t on success, #f otherwise=2E= " > ;; in advance anyway=2E > (setenv "GIT_SSL_NO_VERIFY" "true") >=20 >+ (mkdir-p directory) >+ >;; We cannot use "git clone --recursive" since the following "git >checkout" > ;; effectively removes sub-module checkouts as of Git 2=2E6=2E3=2E >- (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=2E ------IVGZZBH8NY5GWX0U0PG5DDSFS9SCYO Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable I think Google uses JGit for their public facing G= it servers, but I'm not sure=2E

On Fe= bruary 12, 2018 5:59:50 PM EST, Danny Milosavljevic <dannym@scratchpost= =2Eorg> wrote:
Hi Leo,

On Mon, 12 Feb 2018 10:09:39 -0500Leo Famulari <leo@famulari=2Ename> wrote:

I think it's worth adding, but as an optio= n, because there are Git
server implementations, like JGit, that don't = support shallow cloning=2E

Thanks for that! I didn't c= onsider that before=2E=2E=2E

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

diff --git a/guix/build/gi= t=2Escm b/guix/build/git=2Escm
index c1af545a7=2E=2Ee54d92be7 100644
= --- a/guix/build/git=2Escm
+++ b/guix/build/git=2Escm
@@ -37,12 +37,1= 8 @@ recursively=2E Return #t on success, #f otherwise=2E"
;; in adv= ance anyway=2E
(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=2E6=2E3=2E
- (and (zero? (system* git-command "clone" url d= irectory))
+ (and ;(zero? (system* git-command "clone" url directory))<= br> (with-directory-excursion directory
- (system* git-co= mmand "tag" "-l")
- (and (zero? (system* git-command "checkout" = commit))
+ ;(system* git-command "tag" "-l")
+ (invok= e git-command "init")
+ (invoke git-command "remote" "add" "orig= in" url)
+ (and (or (zero? (system* git-command "fetch" "--depth= " "1" "origin" commit))
+ (zero? (system* git-command "= fetch" "origin" commit)))
+ (zero? (system* git-command "ch= eckout" "FETCH_HEAD"))
(begin
(when r= ecursive?
;; Now is the time to fetch sub-modules=2E<= br>
------IVGZZBH8NY5GWX0U0PG5DDSFS9SCYO--