all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Leo Famulari <leo@famulari.name>
Cc: 30428@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 23:59:50 +0100	[thread overview]
Message-ID: <20180212235950.4638aad6@scratchpost.org> (raw)
In-Reply-To: <20180212150939.GA5852@jasmine.lan>

Hi Leo,

On Mon, 12 Feb 2018 10:09:39 -0500
Leo Famulari <leo@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.

  reply	other threads:[~2018-02-12 23:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12  0:16 bug#30428: guix git-fetch doesn't specify "--depth 1" - git clone clones a lot without any use Danny Milosavljevic
2018-02-12 15:09 ` Leo Famulari
2018-02-12 22:59   ` Danny Milosavljevic [this message]
2018-02-13  1:28     ` Leo Famulari
2018-02-13 14:22     ` Leo Famulari
2018-02-13 17:08       ` Marius Bakke
2018-02-13 18:08         ` Leo Famulari
2018-02-13 17:09       ` Marius Bakke
2018-02-14 13:58     ` Ludovic Courtès
2018-02-18 13:38       ` Danny Milosavljevic
2018-02-18 13:53         ` Ludovic Courtès
2020-03-22 20:48 ` Leo Famulari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180212235950.4638aad6@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=30428@debbugs.gnu.org \
    --cc=leo@famulari.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.