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

Re: [PATCH] index-pack: --clone-bundle option

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2016, 23:20 UTC
Message-ID
<xmqqbn6v174b.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqfuw7186z.fsf_-_@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 22 quoted lines
> Note that this name choice does not matter very much in the larger
> picture.  As an initial clone that bootstraps from a clone-bundle is
> expected to do a rough equivalent of:
>
>     # create a new repository
>     git init new-repository &&
>     git remote add origin $URL &&
>
>     # prime the object store and anchor the history to temporary
>     # references
>     git fetch $bundle 'refs/*:refs/temporary/*' &&
>
>     # fetch the more recent history from the true origin
>     git fetch origin &&
>     git checkout -f &&
>
>     # remove the temporary refs
>     git for-each-ref -z --format=%(refname) refs/temporary/ |
>     xargs -0 git update-ref -d
>
> the names recorded in the bundle will not really matter to the end
> result.

Actually, the real implementation of "bootstrap with clone-bundle" is more likely to go like this:

    * The client gets redirected to $name.bndl file, and obtains a
      fairly full $name.pack file by downloading them as static
      files;
    * The client initializes an empty repository;
    * The pack file is stored at .git/objects/pack/pack-$sha1.pack;
    * When the client does a "git fetch origin" to fill the more
      recent part, fetch-pack.c::find_common() would read from the
      "git bundle list-heads $name.bndl" to learn the "reference"
      objects.  These are thrown at rev_list_insert_ref() and are
      advertised as "have"s, just like we advertise objects at the
      tip of refs in alternate repository.

So there will be no refs/temporary/* hierarchy we would need to worry about cleaning up.

Another possible variant is to redirect the client directly to download pack-$sha1.pack; "index-pack" needs to be run on the client side anyway to create pack-$sha1.idx, so at that time it could do the equivalent of "--clone-bundle" processing (it is not strictly necessary to create a split bundle) to find the tips of histories, and use that information when running "git fetch origin".

So, even though I started working from "split bundle", we may not have to have such a feature after all to support CDN offloadable and resumable clone.

Previous: Junio C HamanoNext: Jeff King
Message 6 of 9 in “index-pack: correct --keep[=<msg>]”
  1. index-pack: correct --keep[=<msg>]Junio C Hamano, Mar 3, 2016
  2. Jeff KingMar 3, 2016
  3. index-pack: add a helper function to derive .idx/.keep filenameJunio C Hamano, Mar 3, 2016
  4. Jeff KingMar 3, 2016
  5. index-pack: --clone-bundle optionJunio C Hamano, Mar 3, 2016
  6. Junio C HamanoMar 3, 2016
  7. Jeff KingMar 4, 2016
  8. Jeff KingMar 4, 2016
  9. Eric SunshineMar 3, 2016

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.