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

Re: [RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah"

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Apr 23, 2008, 16:56 UTC
Message-ID
<alpine.LNX.1.00.0804231210000.19665@iabervon.org>
In-Reply-To
<7vhcdstv0f.fsf@gitster.siamese.dyndns.org>
On Wed, 23 Apr 2008, Junio C Hamano wrote:
Show 5 quoted lines
> *1* In that sense, a more sensible order than rewriting "clone" in C in
> its current form would be to make necessary enhancements to the components
> in this sequence that need to implement clone, figure out how they should
> fit together and first make "clone" a four-liner shell script. Then
> rewriting the result in C may become more trivial.

clone can't be a four-liner shell script, because it has to come up with the name of the working directory for a non-bare clone, which doesn't make sense for any other program. Currently, a local clone is special in that it duplicates all of the objects without checking whether the destination already has them (because it can't have anything) or whether they're actually needed; fetch could do some similar stuff, but couldn't do quite that much optimization, because it's not likely the same special case.

Something needs to get the code to figure out the remote HEAD, and it shouldn't be "remote" for clone's use, because then clone would take an extra connection, since "fetch" obviously has to connect and "remote" would run before it and in a separate process.

It also needs to support --reference (list another repository's refs as your refs, because you have that repository as an alternate but don't have your own refs that use its objects), which is sort of plausible for fetch but much less useful.

Aside from that, it's obviously got quite a few lines of option parsing to get the right arguments to the things it calls, as well as determining whether to check out a branch (depending on what we did with the origin) and such.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Jeff King
Message 4 of 9 in “[RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah"”
  1. Paolo BonziniApr 23, 2008
  2. Johannes SchindelinApr 23, 2008
  3. Junio C HamanoApr 23, 2008
  4. Daniel BarkalowApr 23, 2008
  5. Jeff KingApr 23, 2008
  6. Paolo BonziniApr 23, 2008
  7. Junio C HamanoApr 23, 2008
  8. Johannes SchindelinApr 23, 2008
  9. Paolo BonziniApr 24, 2008

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.