threads / discuss / 17909

Shallow clones (git clone --depth) are broken?

Subject: Shallow clones (git clone --depth) are broken?

## tl;dr

2 messages between Feb 19, 2009 and Feb 20, 2009.

replies: 1people: 2as markdown or json

Jim Ramsay· Feb 19, 2009, 19:55 UTC · lore

I've been trying to experiment with shallow clones, however I can't seem to actually create one. Here's what I've tried, for example:

git clone --depth 1 git://git.fluxbox.org/fluxbox.git

However, this gets me everything, and takes quite a while. After it completes, running gitk shows me the entire history, and the size of the .git directory is the same as a full clone I've done previously.

I've tried this with both 1.6.0.2 and 1.6.1.3, to the same effect.

Can anyone out there verify that this --depth option actually does anything? Or could it potentially be the version of git on the server?

If it's not just something odd I'm doing, I can take the time to try to figure out in which version this *does* work, and when it stopped... Though others out there may be more equipped than I to chase this down.

-- 
Jim Ramsay
Jeff King· Feb 20, 2009, 02:49 UTC · re: Jim Ramsay · lore

Re: Shallow clones (git clone --depth) are broken?

On Thu, Feb 19, 2009 at 02:55:24PM -0500, Jim Ramsay wrote:
Show 14 quoted lines
> I've been trying to experiment with shallow clones, however I can't
> seem to actually create one.  Here's what I've tried, for example:
> 
> git clone --depth 1 git://git.fluxbox.org/fluxbox.git
> 
> However, this gets me everything, and takes quite a while.  After it
> completes, running gitk shows me the entire history, and the size of
> the .git directory is the same as a full clone I've done previously.
> 
> I've tried this with both 1.6.0.2 and 1.6.1.3, to the same effect.
> 
> Can anyone out there verify that this --depth option actually does
> anything?  Or could it potentially be the version of git on the
> server?
Sorry, I can't reproduce (using 1.6.0.2):
  $ git clone git://git.fluxbox.org/fluxbox.git full
  Initialized empty Git repository in /home/peff/full/.git/
  remote: Counting objects: 31521, done.
  remote: Compressing objects: 100% (8013/8013), done.
  remote: Total 31521 (delta 24321), reused 30542 (delta 23462)
  Receiving objects: 100% (31521/31521), 8.08 MiB | 499 KiB/s, done.
  Resolving deltas: 100% (24321/24321), done.
  $ du -sh full/.git
  9.2M    full/.git
  $ git clone --depth 1 git://git.fluxbox.org/fluxbox.git shallow
  Initialized empty Git repository in /home/peff/shallow/.git/
  remote: Counting objects: 5402, done.
  remote: Compressing objects: 100% (3310/3310), done.
  remote: Total 5402 (delta 4148), reused 2969 (delta 2057)
  Receiving objects: 100% (5402/5402), 3.07 MiB | 408 KiB/s, done.
  Resolving deltas: 100% (4148/4148), done.
  $ du -sh shallow/.git
  3.5M    shallow/.git

There is some server support required for shallow clone; I didn't check, but I assume that the client would degrade gracefully to a full clone. In which case, is it possible that fluxbox.org upgraded since you tested? Can you try again?

-Peff

← back to recent threads