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

Re: [PATCH] builtin-clone: Implement git clone as a builtin command.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 12, 2007, 18:00 UTC
Message-ID
<Pine.LNX.4.64.0712121237540.5349@iabervon.org>
In-Reply-To
<1197473063.9269.20.camel@hinata.boston.redhat.com>
On Wed, 12 Dec 2007, Kristian H�gsberg wrote:
Show 18 quoted lines
> However, let me just say that the patch I sent is almost just that.
> Part of the patch refactors init-db to be useful from clone, part of the
> code is option parsing and figuring out the git dir, work tree.  Also,
> the part of the patch that does 'git checkout' is approximately 20 lines
> that end up calling unpack_tre() and then write_cache().  The bulk of
> the work here is really just builtin boilerplate code, option parsing
> and the builtin-clone tasks you describe below (HEAD discovery, --shared
> and --reference optimizations and the local hardlink optimization - all
> these are in the 500 line builtin-clone.c I sent).
> 
> And maybe it makes sense to use builtin-remote for the remote add -f
> part, but the fetch part of the patch is 10 lines to set up for
> fetch_pack().  So while I do agree that it makes sense to keep remotes
> handling in one place, doing the fetch_pack() in builtin-clone.c doesn't
> seem like a big duplication of code.  And either way, I agree with
> Dscho, once we have either builtin-clone or builtin-fetch it's easier to
> share code and refactor, and there is not a strong reason to do one or
> the other first.

Er, we have builtin-fetch. We just don't have a way of calling it with all of the option parsing done, but that should be easy. I was expecting that step to get done when clone got converted, or maybe remote...

I agree that the checkout special case when the code knows in advance that you don't have anything checked out beforehand is particularly trivial, and it's probably just as easy to call unpack_trees() and write_cache() as to use an actual checkout implementation.

	-Daniel
*This .sig left intentionally blank*
Previous: Kristian HøgsbergNext: Kristian Høgsberg
Message 10 of 13 in “builtin-clone: Implement git clone as a builtin command.”
  1. builtin-clone: Implement git clone as a builtin command.Kristian Høgsberg, Dec 11, 2007
  2. Daniel BarkalowDec 11, 2007
  3. Kristian HøgsbergDec 11, 2007
  4. Junio C HamanoDec 12, 2007
  5. Junio C HamanoDec 12, 2007
  6. Johannes SchindelinDec 12, 2007
  7. Kristian HøgsbergDec 12, 2007
  8. Johannes SchindelinDec 12, 2007
  9. Kristian HøgsbergDec 12, 2007
  10. Daniel BarkalowDec 12, 2007
  11. Kristian HøgsbergDec 12, 2007
  12. Daniel BarkalowDec 12, 2007
  13. J. Bruce FieldsDec 24, 2007

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.