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

2020-03-22 Thread Leo Famulari
On Mon, Feb 12, 2018 at 01:16:41AM +0100, Danny Milosavljevic wrote:
> git-fetch doesn't allow specifying "--depth 1".
> 
> That means the repo clones are needlessly large.
> 
> Since in packages we only need one specific commit anyhow why do we fetch
> all the other commits?

This was fixed in 329dabe13bf98b899b907b45565434c5140804f5. Closing.





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

2018-02-18 Thread Ludovic Courtès
Hi Danny,

Danny Milosavljevic  skribis:

> It's already much nicer just to try the shallow commit checkout and fall back
> to the current way if it doesn't work - and it's low risk.

Oh right, I hadn’t groked that this is what your patch does.

In that case I’m all for it, it seems to be low-risk indeed.  Perhaps
leave a comment explaining that for some servers “--depth 1” won’t work
when we’re passing a commit and not a tag.

Thank you!

Ludo’.





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

2018-02-18 Thread Danny Milosavljevic
Hi Ludo,

On Wed, 14 Feb 2018 14:58:55 +0100
l...@gnu.org (Ludovic Courtès) wrote:

> I think it’s a great idea.  FWIW, Andy proposed something along these
> lines, but the idea was to use shallow clones for tags only because in
> other cases it might not work (?):
> 
>   https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00258.html

Yeah, some git servers either don't support searching by commit at all
or only support it after enabling it manually in the config file
(justification is some kind of privacy thing where accidentially a
private file could have been pushed to a public repo and then
reverted - with the commit hash you'd still get to it).
 
I'd rather not do the more involved patchset at the time being.
I don't understand git all that well.

It's already much nicer just to try the shallow commit checkout and fall back
to the current way if it doesn't work - and it's low risk.





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

2018-02-14 Thread Ludovic Courtès
Hello,

Danny Milosavljevic  skribis:

> 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?):

I think it’s a great idea.  FWIW, Andy proposed something along these
lines, but the idea was to use shallow clones for tags only because in
other cases it might not work (?):

  https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00258.html

It got stuck on a minor issue: the patch added a ‘tag’ field to
‘git-reference’, which changed the API, and I suggested making things
slightly differently:

  https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00558.html

Would you like to see if both patches could be merged?

Thanks,
Ludo’.





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

2018-02-13 Thread Leo Famulari
On Tue, Feb 13, 2018 at 06:08:58PM +0100, Marius Bakke wrote:
> 
> 
> On February 13, 2018 3:22:58 PM GMT+01:00, Leo Famulari  
> wrote:
> >On Mon, Feb 12, 2018 at 11:59:50PM +0100, Danny Milosavljevic wrote:
> >> 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?):
> >
> >I think that Google's public-facing Git servers use JGit. So, perhaps
> >try shallow cloning Chromium and see if it works.
> 
> "libvpx" in Guix uses Chromiums git infrastructure and is fairly small.

Looks like the Chromium and libvpx Git repos both support shallow
cloning now. That's great news for anyone building Chromium!

But it doesn't help find a Git server that doesn't support shallow
cloning.


signature.asc
Description: PGP signature


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

2018-02-13 Thread Marius Bakke


On February 13, 2018 3:22:58 PM GMT+01:00, Leo Famulari  
wrote:
>On Mon, Feb 12, 2018 at 11:59:50PM +0100, Danny Milosavljevic wrote:
>> 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?):
>
>I think that Google's public-facing Git servers use JGit. So, perhaps
>try shallow cloning Chromium and see if it works.

"libvpx" in Guix uses Chromiums git infrastructure and is fairly small.





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

2018-02-13 Thread Marius Bakke


On February 13, 2018 3:22:58 PM GMT+01:00, Leo Famulari  
wrote:
>On Mon, Feb 12, 2018 at 11:59:50PM +0100, Danny Milosavljevic wrote:
>> 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?):
>
>I think that Google's public-facing Git servers use JGit. So, perhaps
>try shallow cloning Chromium and see if it works.

"libvpx" in Guix uses Chromiums git infrastructure and is fairly small.

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

2018-02-13 Thread Leo Famulari
On Mon, Feb 12, 2018 at 11:59:50PM +0100, Danny Milosavljevic wrote:
> 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?):

I think that Google's public-facing Git servers use JGit. So, perhaps
try shallow cloning Chromium and see if it works.


signature.asc
Description: PGP signature


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

2018-02-12 Thread Leo Famulari
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 
 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.
>
>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.


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

2018-02-12 Thread Danny Milosavljevic
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.





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

2018-02-12 Thread Leo Famulari
On Mon, Feb 12, 2018 at 01:16:41AM +0100, Danny Milosavljevic wrote:
> git-fetch doesn't allow specifying "--depth 1".
> 
> That means the repo clones are needlessly large.
> 
> Since in packages we only need one specific commit anyhow why do we fetch
> all the other commits?

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


signature.asc
Description: PGP signature


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

2018-02-11 Thread Danny Milosavljevic
git-fetch doesn't allow specifying "--depth 1".

That means the repo clones are needlessly large.

Since in packages we only need one specific commit anyhow why do we fetch
all the other commits?