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

Re: Does cloning a shallow repo require special setting in the cloned one?

From
Jeff King <peff@peff.net>
Date
Feb 26, 2009, 10:46 UTC
Message-ID
<20090226104657.GB4226@coredump.intra.peff.net>
In-Reply-To
<87tz6hn1tg.fsf@iki.fi>
On Thu, Feb 26, 2009 at 08:34:51AM +0200, Teemu Likonen wrote:
Show 11 quoted lines
> On 2009-02-25 19:49 (-0800), roylee17 wrote:
> 
> > $ git clone --depth 1 git-full git-shallow2
> > 'git log' still gives a full history
> >
> > Why can't I clone a shallow repo from the git-full?
> > Does it requires some settings in the git-full repo?
> 
> I don't know the "why" part but using file:// URL should work:
> 
>     git clone --depth 1 file:///path/to/git-full git-shallow2

I don't think the behavior is intentional, but a side effect of the fact that git takes some shortcuts when cloning locally. In particular, it will try to copy or hardlink the object database rather than transmitting over the git protocol locally. Using file:// has always been the way to suppress that shortcut.

Perhaps to avoid surprise, that optimization should be turned off for options which cause it to behave differently (like --depth). But I have to wonder what the point of --depth is locally; if you are worried about space, hardlinks (the default) or alternates ("clone -s") are a better solution.

-Peff
Previous: Roy LeeNext: Johannes Schindelin
Message 4 of 8 in “Does cloning a shallow repo require special setting in the cloned one?”
  1. roylee17Feb 26, 2009
  2. Teemu LikonenFeb 26, 2009
  3. Roy LeeFeb 26, 2009
  4. Jeff KingFeb 26, 2009
  5. Johannes SchindelinFeb 26, 2009
  6. Jeff KingFeb 26, 2009
  7. Roy LeeFeb 26, 2009
  8. Jakub NarebskiFeb 27, 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.