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

Re: 'git clone' doesn't use alternates automatically?

From
JPJames Pickens <jepicken@gmail.com>
Date
Jan 31, 2009, 20:08 UTC
Message-ID
<885649360901311208s4bc17ae3me2062b07b302291e@mail.gmail.com>
In-Reply-To
<20090131071238.GC3033@coredump.intra.peff.net>
On Sat, Jan 31, 2009 at 12:12 AM, Jeff King <peff@peff.net> wrote:
> but presumably in your example the second clone is _not_ on the NFS
> mount, and therefore can't hardlink.
That's correct.
> So you can try "git clone -s" to specify that you definitely want
> alternates.

Well, the clone gets the alternates either way. It just doesn't use them to avoid copying the data unless I give -s. More importantly, if 'git clone' worked the way I thought, then when I clone a remote repository for which I have a local mirror, I could avoid typing '--reference <path to local mirror>' by adding <path to local mirror>/objects to the alternates file in the remote repository.

Show 5 quoted lines
> I don't recall clone ever being that clever, but I could be wrong (it is
> not an area of the code that I am too familiar with).
>
> Can you try a test with a few different versions to see if it ever
> behaved as you expected (and if it does, bisect to find the breakage)?

Damn. I was hoping the response would be "it's a regression, and here's a patch to fix it". I went ahead and tested a few old versions and they all behave the same way.

So, is there any reason 'git clone' shouldn't automatically use the alternates that it copied into the new repository? I might look into writing a patch if nobody objects.

James
Previous: Jeff KingNext: Jakub Narebski
Message 3 of 13 in “'git clone' doesn't use alternates automatically?”
  1. James PickensJan 30, 2009
  2. Jeff KingJan 31, 2009
  3. James PickensJan 31, 2009
  4. Jakub NarebskiJan 31, 2009
  5. James PickensJan 31, 2009
  6. Jeff KingJan 31, 2009
  7. Junio C HamanoFeb 1, 2009
  8. Jeff KingFeb 2, 2009
  9. Junio C HamanoFeb 3, 2009
  10. Jeff KingFeb 3, 2009
  11. Junio C HamanoFeb 1, 2009
  12. James PickensFeb 1, 2009
  13. Junio C HamanoFeb 1, 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.