From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: bug#30428: guix git-fetch doesn't specify "--depth 1" - git clone clones a lot without any use Date: Mon, 12 Feb 2018 23:59:50 +0100 Message-ID: <20180212235950.4638aad6@scratchpost.org> References: <20180212011641.3deb7fd6@scratchpost.org> <20180212150939.GA5852@jasmine.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elN4v-0005Vx-Jf for bug-guix@gnu.org; Mon, 12 Feb 2018 18:00:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elN4s-0004f2-Iw for bug-guix@gnu.org; Mon, 12 Feb 2018 18:00:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:60510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elN4s-0004eQ-FA for bug-guix@gnu.org; Mon, 12 Feb 2018 18:00:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1elN4s-0005DV-49 for bug-guix@gnu.org; Mon, 12 Feb 2018 18:00:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20180212150939.GA5852@jasmine.lan> 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: Leo Famulari Cc: 30428@debbugs.gnu.org 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. 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.