git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Feb 20, 2009, 02:49 UTC
Message-ID
<20090220024948.GA22419@coredump.intra.peff.net>
In-Reply-To
<20090219145524.32ca3915@vrm378-02.vrm378.am.mot.com>
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
Previous: Jim Ramsay
Message 2 of 2 in “Shallow clones (git clone --depth) are broken?”
  1. Jim RamsayFeb 19, 2009
  2. Jeff KingFeb 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.